2014년 4월 15일 화요일

Ubuntu 12.04 - select version of java

http://askubuntu.com/questions/84491/cannot-execute-java-program-unsupportedclassversionerror


 
It looks like you've compiled the Java source with a newer version of Java (7) which cannot be executed by the older Java runtime (6). If you don't need/want Java 7, uninstall the openjdk-7-jdk package and install openjdk-6-jdk instead:
sudo apt-get remove openjdk-7-jdk
sudo apt-get install openjdk-6-jdk
The alternative is using the direct paths to the specific versions of the compiler or runtime:

Running the Java 7 runtime

It's possible that Java 6 is still the default (compatibility with older programs?). To force the use of the Java 7 runtime, use the direct path to it:
/usr/lib/jvm/java-7-openjdk-amd64/bin/java tes
(replace amd64 by i386 for the 32-bit version of Java)

Running the Java compiler version 6

If you want to have code compiled for Java version 6, use the full path to the Java 6 compiler:
/usr/lib/jvm/java-6-openjdk/bin/javac tes.java

Alternatives

Like I've said before, if you don't like version 7 or 6, uninstall it (openjdk-7-jdk and openjdk-7-jre for version 7, openjdk-6-jdk and openjdk-6-jre for version 6). It's possible to have both versions installed. Use the alternatives system to configure the default one. Run the below commands to configure the runtime and compiler. It'll provide you a choice for the default.
sudo update-alternatives --config java
sudo update-alternatives --config javac

sublime close without confirmation

  Close without confirm   Yes, you can just write a plugin to set the view as scratch and close it. Then create a keybinding for that c...