Upgrade Java with Netbeans Installed
October 17th, 2008Yesterday I decided to upgrade my Sun Java JDK install, it was at version 1.6.0_06 but I’ve now installed 1.6.0_10.
As a side note also this shows how lazy I get with Linux when you are used to having all your software upgraded automatically. In this case I have to install the Java JDK myself so like most users I’m not that good at updating software, especially when it’s not something I can see, unlike Firefox or some other GUI application.
There are many pros and cons of the Linux vs the Windows way of installing software but there’s no denying that updating software centrally keeps the user far more up to date, and so secure, with no effort at all on the users part. Ironically this is probably something Windows users need more than Linux users.
Anyway, back to the point. After upgrading I ran the usual /usr/sbin/alternatives command to use the new install as my default Java. But after checking some applications that depend on Java I discovered that Netbeans would not start due to the following error:
$ /opt/netbeans-6.1/bin/netbeans Cannot find java. Please use the --jdkhome switch.
Sure enough providing the new JDK location successfully started Netbeans.
$ /opt/netbeans-6.1/bin/netbeans --jdkhome /opt/jdk1.6.0_10/
This was fine but I wanted the change to be permanent but couldn’t find a config file in my $HOME/.netbeans directory. It turns out the file is located at /netbeans-install-directory/etc/netbeans.conf, in my case /opt/netbeans-6.1/etc/netbeans.conf
Edit the following line as root and save the file to make your change permanent
# Default location of JDK, can be overridden by using --jdkhome <dir>: netbeans_jdkhome="/opt/jdk1.6.0_10"