Where is the JDK!?

/usr/lib/jvm/ has all the JDK's you might have installed. For example, these are the contents of my /usr/lib/jvm/ folder:


lrwxrwxrwx 1 root root   14 2009-11-01 11:19 java-1.6.0-openjdk -> java-6-openjdk
drwxr-xr-x 5 root root 4096 2009-08-05 09:59 java-6-openjdk
lrwxrwxrwx 1 root root   19 2010-05-03 20:27 java-6-sun -> java-6-sun-1.6.0.20
drwxr-xr-x 8 root root 4096 2010-06-05 11:43 java-6-sun-1.6.0.20

The JDK 'proper' is the one from Sun, in the java-6-sun directory, which actually links to java-6-sun-1.6.0.20, as you might have noticed already. But let's use the symbolic link:

... and so, the full JDK path is /usr/lib/jvm/java-6-sun.

To check it:


ls -l /usr/lib/jvm/java-6-sun/bin/

should get you a list of SuperVeryImportantFiles such as javac (the java compiler), jdb (the java debugger) and etc.

And the reason I wanted to find out the exact JDK path was for using it with Netbeans, which wanted to know where it was (apparently it doesn't want to autodetect it once it's installed). So I just edited the launcher menu item for Netbeans, appended


--jdkhome /usr/lib/jvm/java-6-sun

to its command, reopened Netbeans again and voilà! Netbeans was happy with the JDK.