我的问题是:我想运行 1.8,但它运行的是 1.6。
当我在 IntelliJ 想法中运行“gradle run”时,我可以看到输出:
10:50:35: Executing external task 'run'... :compileJava :processResources UP-TO-DATE :classes Exception in thread "main" java.lang.NoClassDefFoundError: org/raig Caused by: java.lang.ClassNotFoundException: org.raig at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) :run FAILED
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':run'.
> Process 'command '/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
我修改了/Applications/IntelliJ IDEA 14 CE.app/Contents/Info.plist
<key>JVMOptions</key>
<dict>
<key>ClassPath</key>
<string>$APP_PACKAGE/Contents/lib/bootstrap.jar:$APP_PACKAGE/Contents/lib/extensions.jar:$APP_PACKAGE/Contents/lib/util.jar:$APP_PACKAGE/Contents/lib/jdom.jar:$APP_PACKAGE/Contents/lib/log4j.jar:$APP_PACKAGE/Contents/lib/trove4j.jar:$APP_PACKAGE/Contents/lib/jna.jar</string>
<key>JVMVersion</key>
<string>1.6*,1.7+</string>
我在 JVMVersion 键中添加了“1.8*”。
<key>JVMVersion</key>
<string>1.8*,1.6*,1.7+</string>
我重新启动了 IntelliJ,运行了任务,我得到了:
Execution failed for task ':run'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1