0

I clone JRuby source code from github, and first compile the source code by mvn in the console(with JDK7). Compilation success.

THen i load the whole project into netbeans(8.0), and try compile, but it throws the errors for "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

The JDK is still 1.7. It seems some InvokerGenerator is compiled by other non-1.7 javac. Then i cleaned ruby-core project and even remove target directory manually(Choose project, and right click => choose clean & build). The error is the same.

shijie xu
  • 1,975
  • 21
  • 52
  • Please check the link http://stackoverflow.com/questions/10382929/unsupported-major-minor-version-51-0 – sankar Dec 22 '14 at 05:29

1 Answers1

0

I fixed it.

It seems that the Java version that executes for code diffs the java version i configured for the netbeans. In the netbean>tools>Java Platforms. There is on only one Java configured(Java 7). I double check this is also for the JRuby-core project. However, when i right-click project and built, it uses the open-jdk-6 to execute invoke-generator which is the default JDK in my Ubuntu system.

I think the netbeans should use configured JDK (both compilation and execution) for a project, and it might be bug for netbeans.

The workaround is to setup JAVA_HOME to the right JDK home directory before launching netbeans.

shijie xu
  • 1,975
  • 21
  • 52