I recently installed the open-jdk 7 in my ubuntu server.
But the version is still displayed as :
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.3) (6b24-1.11.3-1ubuntu0.12.04.1)
OpenJDK Server VM (build 20.0-b12, mixed mode)
And if i try to run a java program i get the foll exception :
Exception in thread "main" java.lang.UnsupportedClassVersionError: hello : Unsupported major.minor version 51.0
Which is the consequence of compiling the program with a higher jdk and trying to run in a lower one.
How can i correct this.
Edit:But when i do javac -version I get javac 1.7.0_09 as the response.
It sounds like:
1) You have multiple versions of Java installed (which is perfectly OK to do!) … and …
2) “javac” is picking up the correct version … but “java” is picking up a different version.
SOLUTION:
update-java-alternatives
For example, look at this link: