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:


And when I run printenv | grep "java"


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
What is the output of which java and which javac? –  BryceAtNetwork23 Feb 13 '14 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 –  Philip Crow Feb 14 '14 at 1:30

1 Answer 1

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


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


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:


I don't know what that means. 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:


Unsure on next steps. Copy those links, back them up or remove them. A bit of trial and error and Googling are the next steps. I haven't googled the difference between javac -version and which but I should

HTH and thanks to BryceAtNetwork23

share|improve this answer

Your Answer


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.