JRuby 1.1.6RC1 in maven repo seems to be compiled by JDK 1.6


#1

Hi,

When I ran a program below from maven project, which has dependecy to
JRuby 1.1.6RC1, I got a “bad version number” exception. My maven
project is set up to run on JDK 1.5. This exception is never raised if
I install downloaded archive of JRuby 1.1.6RC1 into local maven repo
manually. 1.1.6RC1 archive in maven repo might not be compiled by JDK
1.5. Does anyone have this trouble?

package pinkred;

import java.util.ArrayList;
import org.jruby.Ruby;
import org.jruby.RubyRuntimeAdapter;
import org.jruby.javasupport.JavaEmbedUtils;

public class JRubySimpleEval {
JRubySimpleEval() {
Ruby runtime = JavaEmbedUtils.initialize(new ArrayList());
RubyRuntimeAdapter adapter = JavaEmbedUtils.newRuntimeAdapter();
adapter.eval(runtime, “puts ‘Hello!’”);
}

public static void main(String[] args) {
    new JRubySimpleEval();
}

}

Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad
version number in .class file
at java.lang.ClassLoader.defineClass2(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:774)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:160)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:254)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
org.jruby.internal.runtime.methods.InvocationMethodFactory.tryClass(InvocationMethodFactory.java:1255)
at
org.jruby.internal.runtime.methods.InvocationMethodFactory.getAnnotatedMethodClass(InvocationMethodFactory.java:716)
at
org.jruby.internal.runtime.methods.InvocationMethodFactory.getAnnotatedMethod(InvocationMethodFactory.java:683)
at
org.jruby.RubyModule.defineAnnotatedMethod(RubyModule.java:779)
at
org.jruby.RubyModule.defineAnnotatedMethod(RubyModule.java:747)
at
org.jruby.anno.TypePopulator$DefaultTypePopulator.populate(TypePopulator.java:50)
at
org.jruby.RubyModule.defineAnnotatedMethodsIndividually(RubyModule.java:658)
at
org.jruby.RubyModule.defineAnnotatedMethods(RubyModule.java:560)
at org.jruby.RubyObject.createObjectClass(RubyObject.java:125)
at org.jruby.Ruby.initRoot(Ruby.java:982)
at org.jruby.Ruby.init(Ruby.java:926)
at org.jruby.Ruby.newInstance(Ruby.java:166)
at
org.jruby.javasupport.JavaEmbedUtils.initialize(JavaEmbedUtils.java:94)
at
org.jruby.javasupport.JavaEmbedUtils.initialize(JavaEmbedUtils.java:69)
at pinkred.JRubySimpleEval.(JRubySimpleEval.java:15)
at pinkred.JRubySimpleEval.main(JRubySimpleEval.java:21)

-Yoko


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#2

It’s possible we pushed a build using Java 1.6, as you suspect. Can you
try pulling tags/jruby-1_1_6RC1 and build it under Java 1.5 yourself, to
confirm it’s ok?

Yoko H. wrote:

}
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:160)
    at org.jruby.internal.runtime.methods.InvocationMethodFactory.getAnnotatedMethodClass(InvocationMethodFactory.java:716)
    at org.jruby.javasupport.JavaEmbedUtils.initialize(JavaEmbedUtils.java:94)

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#3

On Wed, Dec 10, 2008 at 3:22 AM, Charles Oliver N.
removed_email_address@domain.invalid wrote:

It’s possible we pushed a build using Java 1.6, as you suspect. Can you try
pulling tags/jruby-1_1_6RC1 and build it under Java 1.5 yourself, to confirm
it’s ok?

When I installed jruby.jar in jruby-bin-1.1.6RC1.tar.gz, which was
downloaded from http://dist.codehaus.org/jruby/, by using mvn command,

mvn install:install-file -Dfile=jruby.jar -DgroupId=org.jruby
-DartifactId=jruby -Dversion=1.1.6RC1 -Dpackaging=jar

my program ran on JDK 1.5 without any exception.

I think just JRuby’s archive uploaded to maven repository would be
compiled by JDK 1.6.

-Yoko

1.5. Does anyone have this trouble?
Ruby runtime = JavaEmbedUtils.initialize(new ArrayList());
version number in .class file
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at
at


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#4

ouch…ok I probably screwed up during maven build. I think I will
write a ‘release’ script to solve this problem (or build it into mvn
install and ant dist).

-Tom

On Wed, Dec 10, 2008 at 5:34 PM, Yoko H. removed_email_address@domain.invalid wrote:

-DartifactId=jruby -Dversion=1.1.6RC1 -Dpackaging=jar

}
at
at
org.jruby.RubyModule.defineAnnotatedMethodsIndividually(RubyModule.java:658)
at pinkred.JRubySimpleEval.main(JRubySimpleEval.java:21)

http://xircles.codehaus.org/manage_email


Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: removed_email_address@domain.invalid , removed_email_address@domain.invalid


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email