Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Incomplete
-
Affects Version/s: JRuby 1.4.0RC1
-
Fix Version/s: None
-
Component/s: Embedding
-
Labels:None
-
Environment:MATLAB R2009b with JVM 1.6 on WinXP;
Octave 3.2.3 with JVM 1.5 on Leopard PPC
-
Testcase included:yes
-
Number of attachments :
Description
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:
>> 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
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:
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
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.
At least take a look for 1.4, and otherwise bump to 1.5.