Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm running Pangolin (12.04 LTS) and want to sort out some Java stuff where my JVM is pointing at a different place to my Compiler.

To demonstrate, my JVM is as follows:

pcrow@pcrow-HP-notebook:~/Documents$ java -version
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.4)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

Whereas my Compiler points here:

pcrow@pcrow-HP-notebook:~/Documents$ javac -version
javac 1.7.0_51

I have configured the latter through adding an entry to my ~/.profile file. The thing is that I'm not sure what sets the former and I want them to be consistent. In '/etc/environment' I have the following entry:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

And when I run printenv | grep "java"

PATH=/usr/share/maven/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-7-openjdk-amd64/bin
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64


Can you tell me where IcedTea6 is most likely set up on Ubuntu? I'd like to override it if I can and make sure my JVM and Compiler are both using the same version.

share|improve this question
1  
What is the output of which java and which javac? –  BryceAtNetwork23 Feb 13 at 19:17
    
each command points to /usr/bin/java and /usr/bin/javac respectively and I subsequently see that those locations are specified in the PATH variable as it is specified in /etc/environment –  Crowie Feb 14 at 1:30

1 Answer 1

My PATH is in some way influenced by the file /etc/environment as you can see:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

When I execute which java and which javac I see something like follows:

/usr/bin/java

Now, I can't be sure the two are related.* but as a Java dev I'm often adding things to Path - it's how we influence CLASSPATH so that our Java classes are available. And in the Path configuration above you see this excerpt:

PATH="/usr/l...sbin:/usr/bin:/sbi..."

Who knows what that means? Not me ( actually I kind of do now but I didn't know at first). Nevertheless by following the targets given to me by the which command I come to a set of links to executables. Looking at the targets of those links I get something like:

/etc/alternatives/java

Now - I dunno what I'm going to do. Copy those links, back them up or remove them. A bit of trial and error and Googling are the next steps....


HTH and thanks to BryceAtNetwork23


* I haven't googled the difference between javac -version and which but I should and I will

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.