Create an exe with Ruby 1.9.1

Michael,
I maintain Rawr and Monkeybars. Hopefully I can help here.
Our documentation and project organization is pretty behind, but they
have been getting a lot of love lately. Expect to see more docs very
soon (:

It does not explain (for example):

  • if all required jars are included in resulting exe, possibly
    automatically

Rawr does this.

  • if all required ruby-libs are included in resulting exe

Rawr does this, although gems need a little work. There is
documentation on this in the Monkeybars wiki.

  • how to define additional ruby-libs to be included

Same as above.

  • if it’s possible to create GUI applications

Monkeybars, a GUI framework for JRuby has numerous applications that
are packaged through Rawr. Our tutorials always use Rawr.
http://monkeybars.rubyforge.org/
http://kenai.com/projects/monkeybars

  • if it’s possible to set an icon for the resulting exe

Yep

  • how to access resources from java

Maybe I don’t understand this, but this isn’t Rawr’s responsibility.
JRuby handles this pretty well. Any jars you include will
automatically be loaded on the classpath.

  • how to access location of exe-file from java

Do you mean where this lands? If so, it will land in package/windows
in your project.

  • if it’s possible to create 64-bit applications

This largely depends on Launch4J, a Java library that Rawr depends on
for creating exes. However, it is not directly supported by Rawr at
the moment. Is this something you need?

  • how to define main class of Java project

c.main_java_file = ‘org.rubyforge.rawr.Main’
This line comes built into Rawr’s default generated configuration. You
can set it to any class you want, however. The notation is
..

  • if path names are relative to current dir or root-java dir

This will be executed from the directory where the main jar/exe exists.

  • if it’s necessary to compile java classes through this tool.

Yes! Anything inside the c.source_dirs array will be compiled JRuby
or Java.

Even, if some of var- or symbol-names seem to have some useful
meaning, they could also make deamons flying out of my nose.
Example: c.files_to_copy = [] # From where? To where?

During the next iteration for Rawr I will be documenting all of the
config items. Until then I’m more than happy to field questions on our
mailing list:
http://kenai.com/projects/rawr/lists

NetBeans can find and call Rakefiles, so if your JRuby application is
all in place, having those Rakefiles with rawr configuration is not
going to be “hours” of waste.

As I mentioned, there is no JRuby application, it’s a Java
application which uses JRuby-lib for interpretation of some
configuration files.

The recommended approach for doing Monkeybars development is to make a
Java project. Typically we just run the rake tasks from the console.
If you want to use Netbeans to do this with a java project, you’d
probably need to have ant tasks that call out to rake tasks. We
haven’t had any demand for this, but it’s certainly open for discussion.

Therefore, currently there is no rakefile. I would not try to change
the Netbeans-configuration. It is not necessary / should not be
necessary to integrate the jar2exe-process into the Netbeans-build.
Instead, a script should be used to convert jar-delivery to one
single exe.

Adding a rake file doesn’t change the Netbeans config. Rawr will make
a Rakefile for you when you do rawr install inside your project
directory.
I am not aware of any Java-2-exe support for Netbeans.

Just to reiterate: Rawr is getting a face-lift on the documentation. I
expect to have the docs complete in about a month for now. Until then,
please hit us up on the mailing list. Rawr sounds like a great fit for
what you’re doing right now, but it can also do more (OSX .app files,
for example). More features are coming around like applet/webstart
support, Duby support, a pure Ruby main file via ruby2java, automatic
gem jarring, etc.

Logan B.
[email protected]
http://www.logustus.com

On Jun 4, 2009, at 12:35 AM, Michael Bruschkewitz wrote:

Hello Logan!
(btw. do you know they named a car like you? It’s very cheap, but
it’s a car, anyway… :slight_smile:

There’s lots of things named Logan (a town, a mountain, etc), but this
is the first I’ve heard of a car (:

deliveries are both very useful “features” which will help to spread
At first I would insert some lines of feature-description at top of
“rawr”-page.
A very good example may be found at “jar2exe”-page. Google this and
you’ll find description of features even on the Google-page! Try
also “convert jar to exe”.
(Google “convert ruby to exe” doesn’t show “rawr” at first 3 pages…)
“rawr” should fit both, if it works as you described it.

I’ll definitely give these a shot.

  • how to define main class of Java project
    c.main_java_file = ‘org.rubyforge.rawr.Main’
    This line comes built into Rawr’s default generated configuration.
    You
    can set it to any class you want, however. The notation is
    ..

So it would be possible to set this to any Java-class which contains
a main function?
Would it be possible to use “rawr” even if no Ruby files are used?

Yep! There might be better tools if you’re using a pure Java
environment. I’m not to sure about your options there.

  • if it’s necessary to compile java classes through this tool.
    Yes! Anything inside the c.source_dirs array will be compiled JRuby
    or Java.

Is it really mandatory to compile java classes or is it possible to
use only jars?

Java files in your project will need to be compiled to be used, but
you can go with any combination of jars and project-specific Java files.

However, because this is a feature which is often requested, I would
expect such an add-on to be available (soon?) in Netbeans, Eclipse
and other IDE’s.

The Netbeans team has Rawr on their radar and we’ve offered to help
them in any way they need it to make Rawr work with Netbeans.

Maybe moderately paid. It would be useful for many people.

Hopefully, you’ll hear a success-story soon!

Thanks!

Hello Logan!
(btw. do you know they named a car like you? It’s very cheap, but it’s a
car, anyway… :slight_smile:
Thanks to your fast response I will definitely give “rawr” a try and
provide
you with feedback.
So, even if it turns out that “rawr” would not fit my needs for some
reason,
my time will not be wasted.
It will need some time until I find some spare time, but I will
definitely
do.
(For the beginning, you could use my stupid questions for some FAQ -
Fools
Annoying Questions)

Integrating Ruby into Java and possibility to build one-file deliveries
are
both very useful “features” which will help to spread the Ruby-virus
further.

“Logan B.” [email protected] schrieb im Newsbeitrag
news:[email protected]

Michael,
I maintain Rawr and Monkeybars. Hopefully I can help here.
Our documentation and project organization is pretty behind, but they
have been getting a lot of love lately. Expect to see more docs very
soon (:

At first I would insert some lines of feature-description at top of
“rawr”-page.
A very good example may be found at “jar2exe”-page. Google this and
you’ll
find description of features even on the Google-page! Try also “convert
jar
to exe”.
(Google “convert ruby to exe” doesn’t show “rawr” at first 3 pages…)
“rawr” should fit both, if it works as you described it.

  • if all required ruby-libs are included in resulting exe
    Rawr does this, although gems need a little work. There is
    documentation on this in the Monkeybars wiki.

Gems are not on my main issue list.

I also don’t see any problem here, however, it was explicitely mentioned
as
feature at the other apps website. My app is a Swing-app.

  • how to access resources from java
    Maybe I don’t understand this, but this isn’t Rawr’s responsibility.
    JRuby handles this pretty well. Any jars you include will
    automatically be loaded on the classpath.

I had problems packing JRuby into exe. JRuby itself had problems then
internally.
I couldn’t track this down to the end, but it seemed somewhere they
tried to
access files directly instead of resources. I gave up because of lack of
time.

  • how to access location of exe-file from java
    Do you mean where this lands? If so, it will land in package/windows
    in your project.

I meant get full exe path of app from inside Java app. Look for “The
Full
Path of The Generated Exe” on support page of other app.

  • if it’s possible to create 64-bit applications
    This largely depends on Launch4J, a Java library that Rawr depends on
    for creating exes. However, it is not directly supported by Rawr at
    the moment. Is this something you need?

No, I currently do not need it, but mayby it will be necessary in
future.

  • how to define main class of Java project
    c.main_java_file = ‘org.rubyforge.rawr.Main’
    This line comes built into Rawr’s default generated configuration. You
    can set it to any class you want, however. The notation is
    ..

So it would be possible to set this to any Java-class which contains a
main
function?
Would it be possible to use “rawr” even if no Ruby files are used?

  • if path names are relative to current dir or root-java dir
    This will be executed from the directory where the main jar/exe exists.

I meant path-names in config-values.

  • if it’s necessary to compile java classes through this tool.
    Yes! Anything inside the c.source_dirs array will be compiled JRuby
    or Java.

Is it really mandatory to compile java classes or is it possible to use
only
jars?

During the next iteration for Rawr I will be documenting all of the
config items. Until then I’m more than happy to field questions on our
mailing list:
http://kenai.com/projects/rawr/lists

I added this to my favorites.

The recommended approach for doing Monkeybars development is to make a
Java project. Typically we just run the rake tasks from the console.
If you want to use Netbeans to do this with a java project, you’d
probably need to have ant tasks that call out to rake tasks. We
haven’t had any demand for this, but it’s certainly open for discussion.

I would not like to bring more dependencies into the projects.
Therefore I would like to call some script ore use some tool after
Netbeans
or some other IDE or Ant or something else had build the jars.
Because I tests are done based on the jars, I would not like the need
for
compiling the Java-sources again.

I am not aware of any Java-2-exe support for Netbeans.

I only tried to emphasize that currently there is no Rakefile.
I currently tried out “the other tool” which is GUI-only and it would
have
fit my needs perfectly if I only could get JRuby to run inside the exe.
Given a proper delivery process, it is not necessary to create the Exe
in
every turnaround, only just before releases, this could easily be done
manually.

However, because this is a feature which is often requested, I would
expect
such an add-on to be available (soon?) in Netbeans, Eclipse and other
IDE’s.

Maybe moderately paid. It would be useful for many people.

Hopefully, you’ll hear a success-story soon!

Michael B.