How to change JDK in Linux

Linux Mint or Ubuntu may come with the OpenJDK Java compiler and runtime. If you need to work the Sun version of the Java development kit, you will need to download it. You can do this using the Synaptic app or just open a Terminal window, press ALT-F2, then type gnome-terminal

sudo apt-get install sun-java6-jdk

Ideally, the update should have changed the symlinks and paths for your JDK, but just in case the default is still OpenJDK, you can point the Java compiler to point to the newly downloaded Sun JDK.

On a terminal window again, just issue the command.

$ sudo update-alternatives –config java

note: there are 2 dashes before the config.

It will give you an input dialog like this.

Type in the number corresponding to the Sun JDK, then press ENTER. Your JDK should be pointing to Sun JDK now, you can test it by

$ java -version

If you want to show appreciation for my efforts dear reader, you could buy me a tall hazel nut Americano ($2) via PayPal. Thanks
Post navigation

(next post)
| | | | .

{0 Comments .. you can add one }

Leave a comment