我使用的是Xubuntu,我还没有root或sudo帐户。
我也在审查这个问题
How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
但是,我在计算机上做更改的选项较少(我没有安装,我无法安装其他netbeans或Java)。
我想在空闲时间使用netbeans。我有Java,但我无法改变我的环境。
$ update-alternatives --config java
Existen 4 opciones para la alternativa java (que provee /usr/bin/java).
Selección Ruta Prioridad Estado
------------------------------------------------------------
0 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 modo automático
1 /opt/jdk/jdk1.7.0_79/bin/java 110 modo manual
* 2 /opt/jdk/jdk1.8.0_111/bin/java 110 modo manual
3 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 modo manual
4 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 modo manual
Press <enter> to keep the current choice[*], or type selection number:
$
现在回顾javac
$ update-alternatives --config javac
Existen 4 opciones para la alternativa javac (que provee /usr/bin/javac).
Selección Ruta Prioridad Estado
------------------------------------------------------------
0 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 modo automático
* 1 /opt/jdk/jdk1.7.0_79/bin/javac 110 modo manual
2 /opt/jdk/jdk1.8.0_111/bin/javac 110 modo manual
3 /usr/lib/jvm/java-7-openjdk-amd64/bin/javac 1071 modo manual
4 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 modo manual
Press <enter> to keep the current choice[*], or type selection number:
$
我是从(How to set JAVA_HOME in Linux for all users)执行此操作的:
$ /usr/bin/java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
$
$ export JAVA_HOME=/opt/jdk/jdk1.8.0_111
$ export PATH=/opt/jdk/jdk1.8.0_111:$PATH
我正在尝试:
$ export JAVA_HOME=/opt/jdk/jdk1.7.0_79
$ export PATH=/opt/jdk/jdk1.7.0_79:$PATH
但结果是一样的!
$ ls -al
total 2292
drwxr-xr-x 2 someone domain users 4096 ene 9 10:18 .
drwxr-xr-x 24 someone domain users 4096 ene 9 10:18 ..
-rwxr-xr-x 1 someone domain users 7281 sep 30 2016 netbeans
-rw-r--r-- 1 someone domain users 1667465 sep 30 2016 netbeans64.exe
-rw-r--r-- 1 someone domain users 657903 sep 30 2016 netbeans.exe
$
我有同样的问题!!!
$ ./netbeans
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openide/filesystems/FileUtil : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at org.netbeans.JarClassLoader.doLoadClass(JarClassLoader.java:311)
at org.netbeans.ProxyClassLoader.selfLoadClass(ProxyClassLoader.java:259)
at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.netbeans.core.startup.CLIOptions.cli(CLIOptions.java:159)
at org.netbeans.core.startup.CLIOptions.cli(CLIOptions.java:98)
at org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:234)
at org.netbeans.CLIHandler.initialize(CLIHandler.java:519)
at org.netbeans.CLIHandler.initialize(CLIHandler.java:384)
at org.netbeans.MainImpl.execute(MainImpl.java:193)
at org.netbeans.MainImpl.main(MainImpl.java:85)
at org.netbeans.Main.main(Main.java:83)
$
是否可以在这些条件下使用netbeans而不安装它?怎么样?
我使用CentOS 7在家里使用netbeans Independent,效果很好。