J.R.
J.R.

Reputation: 6049

RVM won't install JRuby, gets exception

So, I have rvm installed on my machine, and I type:

rvm install jruby

Everything looks good at first, but eventually I get:

    jruby-1.5.6 - #fetching 
jruby-1.5.6 - #extracted to /home/jenny/.rvm/src/jruby-1.5.6 (already extracted)
Building Nailgun
jruby-1.5.6 - #installing to /home/jenny/.rvm/rubies/jruby-1.5.6
jruby-1.5.6 - #importing default gemsets (/home/jenny/.rvm/gemsets/)
Copying across included gems
Exception in thread "main" java.lang.NoClassDefFoundError: org.jruby.Main
   at gnu.java.lang.MainThread.run(libgcj.so.9)
Caused by: java.lang.ClassNotFoundException: org.jruby.Main not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
   at java.net.URLClassLoader.findClass(libgcj.so.9)
   at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.9)
   at java.lang.ClassLoader.loadClass(libgcj.so.9)
   at java.lang.ClassLoader.loadClass(libgcj.so.9)
   at gnu.java.lang.MainThread.run(libgcj.so.9)
jenny@linux-auvv:~/workspace/pcms_stable> 

I have absolutly no context for debugging this... I honestly have no idea what to do...

I'm on OpenSuse, and when I type "java -version", I get:

    java version "1.6.0_0"
OpenJDK  Runtime Environment (build 1.6.0_0-b11)
OpenJDK Server VM (build 1.6.0_0-b11, mixed mode)

I can't see any references to java requirements for JRuby, though...

As far as RVM, I'm running:

rvm 1.2.4 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/]

I can install other rubies with RVM (1.9.2, 1.8.7, that sort of thing) with no problem, this is the first issue I've ever found.

It doesn't seem to matter WHICH jruby I install, either. My rvm knows about:

# JRuby
jruby-1.2.0
jruby-1.3.1
jruby-1.4.0
jruby[-1.5.6]
jruby-head

I don't even get the same errors for each one of them:

For 1.2.0, 1.3.1, 1.4.0 I get:

Fatal: GCJ (GNU Compiler for Java) is not supported by JRuby.

Where 1.5.6 and head get me the error I mentioned first.

I WANT to use JRuby with Rails 3, so I'm figuring I want the newest version I can get (which is having the exceptions)

Is there ANYTHING I can do, or am I just doomed to not be able to use RVM for my purposes?

EDIT:

I have confirmed that it's not just RVM, it is JRuby that is to blame. To test, I downloaded JRuby without rvm at all, through the website (I chose version 1.6). I unpacked it as per the instructions, and typed:

bin/jruby -v

in the extracted directory.

I got the exact same error:

jenny@linux-auvv:~/jruby-1.6.0.RC1> bin/jruby -v
Exception in thread "main" java.lang.NoClassDefFoundError: org.jruby.Main
   at gnu.java.lang.MainThread.run(libgcj.so.9)
Caused by: java.lang.ClassNotFoundException: org.jruby.Main not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
   at java.net.URLClassLoader.findClass(libgcj.so.9)
   at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.9)
   at java.lang.ClassLoader.loadClass(libgcj.so.9)
   at java.lang.ClassLoader.loadClass(libgcj.so.9)
   at gnu.java.lang.MainThread.run(libgcj.so.9)

So, still have no clue what's going on, but at least I know now it's a jruby issue, and not an rvm one (though I still WANT it installed through rvm)

Edit:

So, I tried updating my OpenJDK, and it was no dice, but I found ANOTHER version of OpenJDK (that I didn't have installed) through YAST, and installed THAT one, and suddenly my manually installed jruby works just fine:

jenny@linux-auvv:~/jruby-1.6.0.RC1> bin/jruby -v

jruby 1.6.0.RC1 (ruby 1.8.7 patchlevel 330) (2011-01-10 769f847) (OpenJDK Client VM 1.6.0_0) [linux-i386-java]

When I type java -version, I even get something different:

    jenny@linux-auvv:~/jruby-1.6.0.RC1> java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.6.2) (suse-0.1.1-i386)
OpenJDK Server VM (build 14.0-b16, mixed mode)

It even works in RVM, so hooray!

Upvotes: 1

Views: 2626

Answers (2)

mhmhmhmh
mhmhmhmh

Reputation: 434

I would try installing the Sun JRE/JDK.

Or perhaps you could reinstall OpenJDK(probably the easiest way to reset it to being the default on your system).

Update:

To change the default java do this. First check which Javas are available:

update-alternatives --list java

To actually change which one you are using do this:

update-alternatives --config java

Upvotes: 2

JUST MY correct OPINION
JUST MY correct OPINION

Reputation: 36107

I think the clue is in this:

Fatal: GCJ (GNU Compiler for Java) is not supported by JRuby.

For whatever reason, your system is configured to fire up GCJ instead of your OpenJDK compiler. Check the docs on your system for how it handles the case where multiple things can provide the same service name (multiple versions of compilers, for example, or multiple interpreters) and see what you can do to have OpenJDK be the default handler for Java compilation and execution.

Upvotes: 0

Related Questions