Hi. I have JD6 running on Ubuntu 7.10, thanks to: http://www.coderanch.com/t/111095/Linux-UNIX/install-JDK-Ubuntu But I noted something weird: Upon trying to run java -version I got: java version "1.6.0_03" Java(TM) SE Runtime Environment (build 1.6.0_03-b05) Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode) But when trying javac -version I got: Eclipse Java Compiler v_774_R33x, 3.3.1, Copyright IBM Corp 2000, 2007. All rights reserved.
I want to use javac of JDK 6, not the IBM one. Any ideas?
You need to know which executable is fired when you type "javac -version". The "which" command comes to rescue:
So now we know that /usr/bin/javac is the one that "answers" our keystrokes. Is it a real program or a symlink?
What! Is a symlink! Lets ls again:
So probably the /etc/alternatives/javac link will point to the not desired javac. Change it (as root) using:
Maybe you installed Eclipse using synaptic (as an Ubuntu Package)? I'd rather prefer to unpack the tgz off the Eclipse web in /opt. This way I control Ubuntu. And soon the rest of the world. BWUAHAHAHAHAHAHAH! ;-)
Well, actually I followed my previous thread literally and all JDK tools are working as expected except for javac which I figured it launches /bin/ecj What I did? I created a symlink to my JDK/bin/javac and moved it to /etc/alternatives I'm not sure if this is right or wrong but it works!
Originally posted by John Todd: What I did? I created a symlink to my JDK/bin/javac and moved it to /etc/alternatives I'm not sure if this is right or wrong but it works!
As Rohan says, you're not supposed to mess with the links in /etc/alternatives manually, instead you should use update-alternatives to manage this for you. Messing with the links manually might confuse update-alternatives if you'll need to use it in the future.