【问题标题】:Jruby "InvokerGenerator : Unsupported major.minor version" with netbeans-8 during compilationJruby“InvokerGenerator:不支持的major.minor版本”在编译期间使用netbeans-8
【发布时间】:2014-12-22 21:37:21
【问题描述】:

我从github克隆了JRuby源码,先在控制台通过mvn编译源码(JDK7)。编译成功。

然后我将整个项目加载到 netbeans(8.0) 中,并尝试编译,但它会抛出错误 "exec-maven-plugin:1.2.1:exec (invoker-generator) @ jruby-core"

cd /opt/pro/jrubysrc/jruby/core; JAVA_HOME=/opt/pro/JDK/jdk1.7.0_40 /opt/pro/netbeans-8.0.2/java/maven/bin/mvn -Dfile.encoding=utf-8 clean install
Scanning for projects...

...       

--- exec-maven-plugin:1.2.1:exec (invoker-generator) @ jruby-core ---
Exception in thread "main" java.lang.UnsupportedClassVersionError: **org/jruby/anno/InvokerGenerator : Unsupported major.minor version 51.0**
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
Could not find the main class: org.jruby.anno.InvokerGenerator. Program will exit.
------------------------------------------------------------------------
Reactor Summary:

JRuby ............................................. SUCCESS [0.948s]
JRuby Core ........................................ FAILURE [1:31.125s]
JRuby Lib Setup ................................... SKIPPED
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1:32.562s
Finished at: Mon Dec 22 01:08:01 AST 2014
Final Memory: 17M/254M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (invoker-generator) on project jruby-core: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

After correcting the problems, you can resume the build with the command
  mvn <goals> -rf :jruby-core

JDK 仍然是 1.7。似乎某些 InvokerGenerator 是由其他非 1.7 javac 编译的。然后我清理了 ruby​​-core 项目,甚至手动删除了目标目录(选择项目,然后右键单击 => 选择清理和构建)。错误是一样的。

【问题讨论】:

标签: java maven netbeans jruby


【解决方案1】:

我修好了。

似乎为代码执行的 Java 版本与我为 netbeans 配置的 Java 版本不同。在 netbean>tools>Java 平台中。只有一个 Java 配置(Java 7)。我仔细检查了这也适用于 JRuby-core 项目。但是,当我右键单击项目并构建时,它使用 open-jdk-6 执行调用生成器,这是我的 Ubuntu 系统中的默认 JDK。

我认为 netbeans 应该为项目使用已配置的 JDK(编译和执行),这可能是 netbeans 的错误。

解决方法是在启动 netbeans 之前将 JAVA_HOME 设置到正确的 JDK 主目录。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-04
    • 1970-01-01
    • 2014-03-17
    • 2018-08-24
    • 1970-01-01
    相关资源
    最近更新 更多