Skip to content
pfussell edited this page Jan 6, 2011 · 7 revisions

» JRuby Project Home Page    » Getting Started with JRuby

JRuby With Wrong Java

[ed:]

You may find that even though you have an up-to-date JDK installed, JRuby does not work on Ubuntu. When running

 jruby -v

You may get errors like:

 java.lang.NoSuchFieldException: fd
 at java.lang.Class.getDeclaredField(libgcj.so.81)

Note: This will be fixed with JRuby 1.1 RC3, though it's uncertain whether all issues running under GCJ will be resolved.

The reason for this may be that even though you have an up-to-date JDK installed, Ubuntu is not using it by default. You need to update your configuration to use the proper JDK. See https://help.ubuntu.com/community/Java for more information on this issue.

On Ubuntu 7.10, when I ran:

 java -version

I saw the following:

 java version "1.5.0"
 gij (GNU libgcj) version 4.2.1 (Ubuntu 4.2.1-5ubuntu5)

I then ran:

 sudo update-alternatives --config java

I picked the option that said /usr/lib/jvm/java-6-sun/jre/bin/java. Following that, running:

 java -version

Gave me:

 java version "1.6.0_03"
 Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
 Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)

And JRuby then worked fine.

Clone this wiki locally