Compiler #2 is under way!

Hi JRuby users,

I am working on a software that makes use of Jruby, but I want to
instantiate objects from JRuby classes inside a Java program. This
requirement can be made through compiling JRuby class files into
native java .class files. I have downloaded the compiler2.rb script,
bitescript folder and run the compiler2.rb script to generate native
java .class files.

I used the command line mentioned in this article →
http://www.mail-archive.com/[email protected]/msg04807.html

jruby -I …/bitescript/lib/ tool/compiler2.rb MyObject MyRubyClass
myruby

It gives a load error at require statement - can not load library –
MyObject and quit. (line 461 in compiler2.rb).

I have noticed that the bundle containing Jruby-1.4.0 does not contain
the script compiler2.rb in the tool folder. So, I had to search for
and download compiler2.rb and put the file into the tool folder to
Jruby bundle. Is there something wrong. I have been struggling to
generate native java code from Jruby scripts so that I can instantiate
objects in a normal Java program.

So any advice?

Thanks,
Ahmed Nabhan


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Ahmed,

I had the same problem, and couldn’t get ruby2java to work either.

What finally worked for me is this:
http://kenai.com/projects/jruby/pages/GeneratingJavaClasses

I gather compiler2 was an early version of ruby2java, which in turn was
deprecated in favor of an extra flag in jrubyc.

Thank you,

Actually, I wonder how people are talking about JRuby 1.5, while the
latest version for download is 1.4. I tried to find a version higher
than 1.4.

The problem is the the switch --java is not recognized by the jrubyc
command.

So, where is JRuby 1.5?

Best wishes,
Ahmed R. Nabhan

Quoting entropic_rune [email protected]:

java .class files.
the script compiler2.rb in the tool folder. So, I had to search for


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

On Mar 13, 2010, at 10:44 PM, Ahmed Ragab Nabhan wrote:

Thank you,

Actually, I wonder how people are talking about JRuby 1.5, while the latest version for download is 1.4. I tried to find a version higher than 1.4.

The problem is the the switch --java is not recognized by the jrubyc command.

So, where is JRuby 1.5?

Best wishes,
Ahmed R. Nabhan

Ahmed,

JRuby 1.5 is the next release under active development. There is no set
release schedule, but it’s going to be soon. If you want to test it, you
can either check out the source code and build it yourself, or try
http://ci.jruby.org/snapshots/ for nightly builds.

Hope this helps.

Hiro

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Thank you Hiro for the prompy reply.

I will download the nightly build version and experiment with it.

Best wishes,
Ahmed

Quoting Hirotsugu A. [email protected]:

jrubyc command.
it, you can either check out the source code and build it yourself,


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I use rvm (http://rvm.beginrescueend.com/) to juggle different versions
of
ruby. You can install the current version of jruby thusly:

rvm install jruby-head
rvm jruby-head

You need to install any gems you need. Then just run ruby (not jruby).

If do you want jruby-complete, and have Ant installed, then find out
which
directory is used:
which ruby

probably ~/.rvm/jruby-head/bin/ruby in which case

cd ~/.rvm/jruby-head
ant jar-complete

rvm will keep using the incomplete jar (with a warning) unless you
rename
it:
mv ~/.rvm/jruby-head/lib/jruby.jar
~/.rvm/jruby-head/lib/unused_jruby.jar