Kristian Lunde

Java on Ubuntu

without comments

The other day I decided that it was about time to refresh my java knowledge. I’ve done some java development at work lately, but besides that It has been about 3 years since I last wrote any decent java apps. I have a few ideas of some small cool apps I want to write, but first of all I had to check the java installation on my machine.

Im currently sitting on a Ubuntu 7.04 installation, so I started out by opening my console and typing

java -version

I was a bit surprised about the result, java version could not be determined, I found out that 4 different versions of java were installed and neither the classpath or java_home were set. The java version I wished to used were not among the installed versions. I used the java installation guide on to install my preferred java version, the java 6 version from Sun. The guide was straight forward and the java installation seemed to work as expected after completing the guide.

kristian@Saturn:/usr/lib$ java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

Looking good. So I tried typing:

kristian@Saturn:/usr/lib$ javac -version
javac: error while loading shared libraries: cannot open shared object file: No such file or directory

Not looking that good, something was wrong :P I googled the result and found my mistake. Earlier while I was trying to get it all together with the 4 different java versions I changed the symlink in /usr/bin/ and I forgot to add the -s when I created the link. Removing the symblink and recreating it did the trick.

kristian@Saturn:/usr/bin$ sudo ln -s /etc/alternatives/javac javac

The javac in /etc/alternatives is a symblink to the current java version. And trying the all famous javac -version now result in the anticipated result:

kristian@Saturn:~$ javac -version
javac 1.6.0_03

Now I’m all set to go and try out my java skills :P

Be Sociable, Share!

Written by Kristian Lunde

May 2nd, 2008 at 10:04 am

Posted in Java,Linux,Programming

Tagged with ,

Leave a Reply

Get Adobe Flash player