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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E184bc2347f90dd61b509de6eb43a8b6?d=identicon&s=25 Yoko Harada (Guest)
on 2008-12-09 21:06
(Received via mailing list)
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.<init>(JRubySimpleEval.java:15)
        at pinkred.JRubySimpleEval.main(JRubySimpleEval.java:21)

-Yoko

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2008-12-10 09:23
(Received via mailing list)
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 Harada 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
E184bc2347f90dd61b509de6eb43a8b6?d=identicon&s=25 Yoko Harada (Guest)
on 2008-12-10 17:34
(Received via mailing list)
On Wed, Dec 10, 2008 at 3:22 AM, Charles Oliver Nutter
<charles.nutter@sun.com> 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
13313ac2ec7ba7c43b1b952db034ff3b?d=identicon&s=25 Thomas E Enebo (Guest)
on 2008-12-10 23:43
(Received via mailing list)
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 Harada <yokolet@gmail.com> 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: enebo@acm.org , tom.enebo@gmail.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
This topic is locked and can not be replied to.