Calling JRuby from MATLAB/Octave fails at enumerator library
------------------------------------------------------------

                 Key: JRUBY-4106
                 URL: http://jira.codehaus.org/browse/JRUBY-4106
             Project: JRuby
          Issue Type: Bug
          Components: Embedding
    Affects Versions: JRuby 1.5
         Environment: MATLAB R2009b with JVM 1.6 on WinXP;
Octave 3.2.3 with JVM 1.5 on Leopard PPC
            Reporter: Ian Dees
            Priority: Minor
             Fix For: JRuby 1.5


MATLAB and Octave, two environments that can call into Java libraries, both 
encounter errors when they try to call into JRuby.  Here's a MATLAB interaction 
demonstrating the behavior:

{noformat}
>> javaaddpath 'C:\jruby-complete.jar' 
>> import org.jruby.Main; 
>> jruby = Main(); 
>> jruby.run('--version'); 
jruby 1.5.0dev (ruby 1.8.7 patchlevel 174) (2009-10-16 6586) (Java HotSpot(TM) 
Client VM 1.6.0_16) [x86-java] 
??? Java exception
{noformat}

To log the contents of that exception, I stuck a custom Java class in between 
MATLAB and JRuby, and caught a {{NullPointerException}} with the message: 
{{library `enumerator' could not be loaded.}}

At first, I suspected a bug in MATLAB, since the equivalent Java code is able 
to call into JRuby.  But then, see this interaction with Octave on a completely 
different platform:

{noformat}
octave-3.2.3:1> pkg load java;
octave-3.2.3:2> java_init;
octave-3.2.3:3> javaaddpath("/Users/username/jruby-complete.jar")
octave-3.2.3:4> java_invoke("org.jruby.Main", "main", {"--version"});
jruby 1.5.0dev (ruby 1.8.7 patchlevel 174) (2009-10-17 6586) (Java HotSpot(TM) 
Client VM 1.5.0_20) [ppc-java]
error: [java] org.jruby.exceptions.RaiseException: library `enumerator' could 
not be loaded: java.lang.ClassNotFoundException: 
org.jruby.libraries.EnumeratorLibrary
{noformat}

Are MATLAB and Octave doing something funky with class loaders?  This issue is 
an obstacle to extending these environments in JRuby, since the exception 
occurs before any extension (using the Ruby-embed APIs) can run.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

    http://xircles.codehaus.org/manage_email


Reply via email to