Month: May 2011

Java: getSystemJavaCompiler returns null!

After reinstalling my laptop with Ubuntu Natty, I had an issue with one of my custom built tools.  I have this tool that installs a Tomcat-based web application and server.  In the part that compiles the JSON library, I received a NullPointerException.

On further examination, I found that ToolProvider.getSystemJavaCompiler() was returning null for some reason.  I found the answer on IBM DeveloperWorks:

The ToolProvider.getSystemJavaCompiler()method can return null if tools.jar is not in the application’s classpath. The CharStringCompilerclass detects this possible configuration problem and throws an exception with a recommendation for fixing the problem. Note that Sun’s licensing allows tools.jar to be redistributed with the JRE.

What I found was that I was using a JRE instead of a JDK installation.  Of course, when I switch the Java Home to my JDK, I had some other error and the App wouldn’t even run.  So, I added the tools.jar from the JDK installation to the classpath and ran it with the JRE, and everything worked fine.

So, here is the code I use to compile (including the catch for the missing tools.jar):

		JavaCompiler jc = ToolProvider.getSystemJavaCompiler();
		// handle issue where tools.jar is not on the classpath
		if(jc == null) {
			log.logException(new InstallException("Could not access the system Java compiler -- check to make sure tools.jar is on the class path."));
		StandardJavaFileManager fm = jc.getStandardFileManager(null, null, null);
		File compilePath = new File(unzipPath, "org/json");
		Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(compilePath.listFiles());
		for(JavaFileObject f : files) {
			log.logInformation("Compiling - " + f.getName());
		CompilationTask task = jc.getTask(log.getStream(), fm, null, null, null, files);
		try {
		} catch (IOException e) {
			log.logException(new InstallException("Could not unzip " + zipPath, e));
		boolean result =;
		log.logInformation("**Compile result = " + result);


IBM DeveloperWorks: Create dynamic applications with

Chrome and Gnome, Unity Integrating?

I read about a feature on the about:flags screen entitled “Experimental GNOME menu bar support”, and it caught my attention.  Apparently, I don’t have a late enough installation of Chrome to get this feature, so I can’t play with it, but I wanted to keep my eye out.

So, I found reference to the “Experimental GNOME menu bar support” in a bug report, and it referred me to an 81170 revision.  That led me to the corresponding Code Review.  Now, it looks to me like this revision changed it.

Now, this bug is labeled part of Milestone-13, so does that mean that I won’t see it until I get Chrome 13.  Right now I have version 11.0.696.68, and 13 is a ways off unless I go to the unstable release.

Please comment if you can point out anything else.  Otherwise, it just waiting…

Messing with an HTC HD2 Phone

Well, this past week I became the new owner of an HTC HD2 phone.  I had read that you can flash them to Android, and so begins my saga!  I have it most of way, but it is still a little flaky.  I was actually surprised that it was more difficult than I remember my G1 being.  It was because there were too many partial directions that conflicted.

Below, I will give you some unorganized links and thoughts.  It was too crazy to create a step by step process.

Read More

DD-WRT on Linksys350N

I just flashed my router, and I wanted to provide some links to come back to.

In case you aren’t familiar with DD-WRT, it is a custom router firmware that provides more features than the factory delivered one.  I specifically bought my router because it was on the list of supported devices.  Here are some of the features I use:

  • DNS — I can point DNS names to special IP addresses
  • VPN — I am thinking about using the Open VPN server
  • I have considered trying to install Squid or Dans Guardian on the device to make a transparent proxy, but I haven’t fully fleshed out that idea.

According to the main website, here is their description:

DD-WRT is a Linux based alternative OpenSource firmware suitable for a great variety of WLAN routers and embedded systems. The main emphasis lies on providing the easiest possible handling while at the same time supporting a great number of functionalities within the framework of the respective hardware platform used.

First, if you are using the LinkSys350N, you have to make sure that you have version one.  Here is an article on how you can check:

Cisco Home Community: WRT350N – How to tell if it’s V1 or V2? Having major problems with it

Here are the instructions for installing:

DD-WRT Wiki: Linksys WRT350N

Since I already had an older version of DD-WRT on the router, these are the instructions that applied to me:

You can now upgrade to any generic dd-wrt build except Micro. Be sure to always do a hard reset prior to flashing another build, do a power cycle followed by another hard reset after flashing, and NEVER re-use a configuration file from a previous build or another router. Reconfigure from scratch.

So, my biggest question was remembering how to do a hard reset.  This article solved my problem:

DD-WRT Wiki: Hard Reset Or 30/30/30

Basically, you hold the resest button, wait 30 seconds, pull the power for 30 seconds, and plug it back in for 30 seconds (holding the reset button the whole time).  It takes about 3 or 4 hands to do.  I think next time I may try to commands from telnet.

I flashed the new v24 SP2, and here is the Change Log:

DD-WRT Wiki: Change Log

Adding Apps to Unity’s Dash

Usually, you install apps from either the Ubuntu Software Center or Synaptic or apt-get.  In those cases, the package manager automatically adds the new programs to the menu.  But, what if you install a program manually?

Before Unity, I could right click on the menu and choose Edit Menus.  Now, in Unity, that option is not there.  For that matter, the menu isn’t there.

So, I found that I could type “Main Menu” in the dash to get to the same interface as before:

Main Menu Editor

You can easily add a new menu item in this tool:

Adding Menu Item

Previously, I found that the dash didn’t pick the new menu item up until after I rebooted.  When I just tried it, it worked without me needing to reboot.  Maybe an update fixed it or something.

If you have trouble with it not working, explore this command to start and stop the indexing tool:

zeitgeist-daemon --quit

zeitgeist-daemon &


Installing Sun Java 6

I was able to install the package sun-java6-jdk from synaptic with no problems.  The update alternatives were what caused me problems:

skp@pecan:~$ sudo update-java-alternatives --list
[sudo] password for skp:
java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk
java-6-sun 63 /usr/lib/jvm/java-6-sun
skp@pecan:~$ sudo update-java-alternatives --set java-6-sun
update-alternatives: error: no alternatives for
update-alternatives: error: no alternatives for
update-alternatives: error: no alternatives for
update-alternatives: error: no alternatives for

These errors threw me off at first because I thought they kept it from working.  You can run java -version to see that it really is using the correct version.  Sun’s version reports this:

skp@pecan:~$ java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

Open JDK reports this:

skp@pecan:~$ java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.1) (6b22-1.10.1-0ubuntu1)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

As far as I can tell, the “No Alternatives for” messages aren’t causing a problem, so I am not going to worry about it.  If you have any info on that, please comment.

This is the error message that I am getting from my Java that the Sun JDK has solved in the past. I’ll leave it for another later post, but I wanted to share it in case anyone has any ideas. Please comment if you do:

The program '.' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
  (Details: serial 1359 error_code 8 request_code 140 minor_code 4)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)


Ubuntu 11.04 Natty First Thoughts

This weekend, I finally installed an Ubuntu release close to its release date.  This is probably the closest I have ever gotten it done!  So, here are my first thoughts after using it two work days.

The Install

The install went very well for me.  I have a Broadcom wireless card, which has given me problems in the past.  I was expecting to need to plug it into the wired network to get it to work.  I chose to install rather than use the try Ubuntu mode.  At first, the network indicator said that hardware drivers were not enabled and I could not connect.  I went ahead and told it to download updates as it installed knowing it would not be able to.  Then, I checked part way through copying the files and found that I could connect.  Once booted, I only had a couple of updates available in Update Manager so I am wondering if it actually did download them as it installed.  Also, the wireless was just working without me having to do anything after the install!

What I liked

First, it was new.  I like new features and new software — this definitely had the new feeling.  Unity is definitely different (in a good way).

I like the dash and the way the features comparable to gnome-do are built right into the interface.  The desktop interface is pretty light, yet I can quickly open the apps I want.

I like the way the launcher is on the left.  I have a wide screen laptop, and it probably makes more sense to use up the width rather than the height for the launcher.  Also, I like that it auto-hides when I have windows that use up the entire width of the screen, but otherwise, it always displays.

Notification Area

One issue I had was with a couple of applications that normally show icons in the notification area: Shutter and Gnome-RDP.  Shutter mentioned that it was waiting on a Perl interface to do the notifications, but I think I read about a fix that I will have to follow up with.

What surprised me is that I had a couple of other applications that were able to use the notification area.  Skype worked just fine.  Also, I have an application I wrote myself that worked with no problems: Project Sarah.


I usually use RDesktop not in full screen mode, but in a window that fills up the screen.  This makes it easy to switch between the remote desktop and the local.  I can also drag the window around if I need to see part of the remote and my desktop at the same time.

Unfortunately, Unity takes all the decorations off RDesktop now, and I can’t reposition the window.  That was a little frustrating.

Dual Screen Issues

I liked the fact that Ubuntu seemed to autodetect when I unplugged my external monitor.  It automatically switched back to single screen mode.

The problem is that I couldn’t see anything on the external screen.  The clock displayed with everything on the top, but below that was black.  I could drag windows across to the screen, and they would just disappear.  When I set it to mirror, both screens looked fine and everything worked as planned.

I also had trouble with my Java application crashing with a bizarre error.  When I didn’t have the external monitor connected, it worked fine.  I have typically been able to solve that problem by installing the Sun JDK as opposed to the OpenJDK.  I need to work through installing the Sun JDK, and that might do the trick.

Various Usability Issues

For the most part, I liked the launcher and the new interface, but there were a few things I have to get used to.  For example, in the old Gnome interface, I could minimize a window from the task bar by clicking on it after it is already active.  That doesn’t seem to work in Unity.

Also, I had trouble installing new custom menus.  I wanted to create a menu item for my Java programs that I wrote.  I also usually create a menu item for the different Eclipse profiles.  Before, I would right click on the Applications Menu and choose Edit Menu.  Now, it took me a bit to learn that I had to open the “Main Menu” application from the Dash.

Then, once I added the menus, they didn’t show up when I searched from the Dash until after I rebooted.  There’s got to be an easier way to add applications to the list or at least a way to reindex without rebooting.  I’ll follow up when I find it.

One more thing I noticed.  Most of the time I use the keyboard to launch applications (before Unity with Gnome-Do).  But, every once in a while my hand is already on the mouse, and I would rather use that.  Or, maybe I can’t quite remember the name of the program I want to open (hey, I am getting older).  Maybe I just need to get used to the new interface, but the Applications menu seemed a little easier for the mouse.


Previously, I could go to the Applications Menu to find all the different programs to change settings.  At first, I had trouble figuring out where I could go.  I wanted to see if there where any new settings.

Well, I found the Gnome-Control-Center in the power menu.  Instead of rebooting, you can go to “System Settings”.


All in all, I am really excited about my new Ubuntu and Unity.  I will have to blog some more as I get past the issues in case you are going through them too.