Skip to main content

NetBeans on Ubuntu

Posted by gsporar on August 22, 2007 at 3:40 PM EDT

Roumen had a blog entry last week that featured the Synaptic package manager running on Ubuntu. It shows that the NetBeans IDE is a first-class citizen in the Ubuntu multiverse. Much of the groundwork for making this happen was done by Tom Marble, and he describes some of the details in this blog entry.

I used Tom's instructions to install both the JDK and NetBeans IDE version 5.5.1 on Ubuntu 7.04. Those instructions are a bit out of date now, though, because you no longer have to use the repository that Tom setup on download.java.net. Everything you need is in the standard Ubuntu repositories. And if you want to install the latest NetBeans 6 milestone on Ubuntu, a tutorial is available for that as well.

My interest in all of this goes beyond just NetBeans and the JDK. I should start by admitting: I am not an operating system guru. But I know what I like. :-) And I like Ubuntu quite a bit. I think that attitude might draw scorn from some members of the Linux community who see Ubuntu users as easily-duped fanboys (for just one example, check out the comments on this entry). If I deserve scorn for liking Ubuntu, bring it on.

But I am getting ahead of myself... My Sony VAIO laptop is almost two years old now. It came with Windows XP and I did some re-partitioning so that I can have two additional operating systems (and use GRUB to choose between them): Solaris and Linux.

I originally installed Ubuntu in February of 2006, so that was version 5.10. I did not have time to use it much though because I installed Solaris at the same time and really got into using it.

My desire to create Flash demos of the NetBeans IDE in action (a few examples: 1, 2, and 3) pushed me back to Windows XP. I could not find good screen capture software for Solaris. So I stuck with Windows XP for quite a while, even though I'm not wild about it. The whole "have you updated your virus definitions?" thing gets tiresome (yes, I know Linux has also been targeted by malware, but not as often). And I wanted a bash command line (yes, I know that is possible under Windows XP, but I am really lazy when it comes to some things).

Meanwhile, JDK 6 came out with improved support for Swing applications running on the GTK look and feel. That sounded interesting, but the straw that broke the camel's back was when I was making plans earlier this year to attend O'Reilly's Open Source Convention (OSCON). I was scheduled to do a presentation and Sun had a booth where Brian Leonard and I would be able to do demos. I hated to show up at an open source convention using a closed-source operating system, so I decided to give Ubuntu another try.

Why not Solaris? The Solaris guys have reportedly made good progress on improving the user experience, but I wanted to try something different. Tom had recently published his Ubuntu blog entry so I figured it was time to really dive into Ubuntu. I hope to have time to update my Solaris installation soon.

So I replaced my 5.10 installation with 7.04. Wow. It is impressive. Things just work, 95% of them with no effort on my part. The wireless works. VNC works. VPN works. Skype works. And on and on. Very different than in 2003 when I tried Red Hat or in 2005 when I tried SUSE.

And the NetBeans IDE looks pretty good running on it. Even blown up on a large screen at OSCON. There are still some look-and-feel glitches that I suspect are Swing issues (and probably some IDE issues as well, I have filed one). But all-in-all it has been great. Perhaps it is just my imagination, but it feels like the IDE runs faster than when I boot Windows XP. In all fairness, when I boot Windows XP the IDE and my project files are being read from a FAT32 partition. To do a fair comparison I should move them to an NTFS partition, since everything runs from a ReiserFS partition when I boot Ubuntu.

There were a few configuration issues that I had to iron out. Read on for the full details.....

The first step was to make sure that I could plug in an external monitor. This capability is crucial for my job because I do presenations on a regular basis. The fix was easy - change /etc/X11/xorg.conf by adding the two lines shown in bold below:

Section "Device"
	Identifier	"Intel Corporation 82852/855GM Integrated Graphics Device"
	Driver		"i810"
	BusID		"PCI:0:2:0"
        Option          "MonitorLayout" "CRT,LFP"
        Option          "Clone"         "true"
EndSection

Many thanks to Geertjan for providing the tip. Note that this technique only seems to work if you have the right combination of video chip/device driver. Luckily, I do. Check Geertjan's follow-up entry for some information on doing this with NVidia.

Next up was getting sound to work. From doing a bit of research, it appeared that my sound card was supported and configured correctly. But no sound was coming out. A bit of searching around found these (somewhat odd) steps and they worked!

The only really painful problem I ran into was after I had been using Ubuntu for a couple of weeks. Everything was going smoothly, including wireless internet access on a few different wireless networks. Then I checked in to a hotel in Miami and my wireless internet access slowed to a crawl - it was completely unusable. I could connect but could not use the internet.

So I booted up WindowsXP and started Googling. There were several suggestions: turn off IPv6, change the DNS configuration, remove entries from /etc/nsswitch.conf, and finally turn off TCP window scaling. Turning off TCP window scaling did the trick - and things have been going smoothly ever since.