[dx] Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
[dx] at java.lang.ClassLoader.defineClass1(Native Method)
[dx] at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
[dx] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[dx] at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
[dx] at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
[dx] at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[dx] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[dx] at java.security.AccessController.doPrivileged(Native Method)
[dx] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[dx] at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
[dx] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[dx] at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
[dx] at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
BUILD FAILED
/home/suker/work/dev/android/android-sdk-linux/tools/ant/build.xml:888: The following error occurred while executing this line:
/home/suker/work/dev/android/android-sdk-linux/tools/ant/build.xml:890: The following error occurred while executing this line:
/home/suker/work/dev/android/android-sdk-linux/tools/ant/build.xml:902: The following error occurred while executing this line:
/home/suker/work/dev/android/android-sdk-linux/tools/ant/build.xml:283: null returned: 1
---------------------------------------------------
java.lang.UnsupportedClassVersionError: test_hello_world :
Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
---------------------------------------------------
fixed :
1.
xx$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
xx$
2.
xx$ javac -version
javac 1.8.0_74
xx$
3. must
JRE 6 -> JDK 6
JRE 7 -> JDK 7
And so on.
---------------------------------------------------
The reported major numbers are:
J2SE 8 = 52,
J2SE 7 = 51,
J2SE 6.0 = 50,
J2SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45
(Source: http://en.wikipedia.org/wiki/Java_class_file)
---------------------------------------------
4. if 1-3 can not fixed this problem, may be this also error
[suker@suker-Precision-T1700:Demo]$ sudo update-alternatives --config java
[sudo] password for suker:
有 2 个候选项可用于替换 java (提供 /usr/bin/java)。
选择 路径 优先级 状态
------------------------------------------------------------
0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 自动模式
1 /home/suker/work/setup/jdk1.8.0_74/bin/java 700 手动模式
* 2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 手动模式
要维持当前值[*]请按回车键,或者键入选择的编号:1
update-alternatives: using /home/suker/work/setup/jdk1.8.0_74/bin/java to provide /usr/bin/java (java) in 手动模式
[suker@suker-Precision-T1700:Demo]$
[suker@suker-Precision-T1700:Demo]$
[suker@suker-Precision-T1700:Demo]$
[suker@suker-Precision-T1700:Demo]$ sudo update-alternatives --config javac
有 2 个候选项可用于替换 javac (提供 /usr/bin/javac)。
选择 路径 优先级 状态
------------------------------------------------------------
0 /usr/lib/jvm/java-7-openjdk-amd64/bin/javac 1071 自动模式
1 /home/suker/work/setup/jdk1.8.0_74/bin/javac 700 手动模式
* 2 /usr/lib/jvm/java-7-openjdk-amd64/bin/javac 1071 手动模式
要维持当前值[*]请按回车键,或者键入选择的编号:1
update-alternatives: using /home/suker/work/setup/jdk1.8.0_74/bin/javac to provide /usr/bin/javac (javac) in 手动模式
[suker@suker-Precision-T1700:Demo]$