Create an exe with Ruby 1.9.1

Hello !
I’m working on Windows and I’m creating softwares.

I would create an exe file for a program written in Ruby 1.9.1.
But Rubyscript2exe and Exerb are using Ruby 1.8.7 (or 1.8.6).

How can I create an exe file working on Windows for anybody ?
Why are they so few informations and librairies to create exe files ?

90% of computers in the world are Windows.
Making cool softwares in Ruby will be useless if they can’t work on 90%
of computers…

As far as I know, there’s currently no way to generate an exe out of a
ruby
1.9 script, short of packing the ruby script into the exe and calling
the
external ruby interpreter. Since the ruby interpreter runs on windows
just
fine though, why are you in need of an exe?
In the future it may be possible to compile the ruby bytecode into an
exe
and bundle an interpreter with it, but I’m pretty sure nothing like that
exists yet.

Alex

On Tue, May 19, 2009 at 3:36 PM, Marc-antoine Kruzik

Marc-antoine Kruzik wrote:

Making cool softwares in Ruby will be useless if they can’t work on 90%
of computers…

You assume that the only way to run a Ruby program on Windows is to
bundle it up with a 1.9.1 interpreter into an executable. Clearly that’s
not true. You can bundle a Ruby program with a 1.8.6/1.8.7 interpreter,
or you can just install Ruby 1.9.1 and run all the Ruby programs you can
lay your hands on. You also assume that cool software only runs on
Windows. I can assure you that’s not true.

I’d like to point out that Rubyscript2exe and Exerb are the work of
volunteers. It may be true that 90% of the computers in the world are
Windows, but if so, why aren’t 90% of the volunteers contributing to
Ruby from the Windows world? As near as I can tell there’s just a
handful - less than a hundred? less than 20? - of people with experience
in Windows who are actively contributing to Ruby.

Tim H. wrote:

Marc-antoine Kruzik wrote:

Making cool softwares in Ruby will be useless if they can’t work on 90%
of computers…

You assume that the only way to run a Ruby program on Windows is to
bundle it up with a 1.9.1 interpreter into an executable. Clearly that’s
not true. You can bundle a Ruby program with a 1.8.6/1.8.7 interpreter

Yes, I still have released programs written for Ruby 1.8.6.
But can I really run a program made with Ruby 1.9.1 ?

You also assume that cool software only runs on
Windows. I can assure you that’s not true.

I didn’t say that. I’m saying that cool softwares made with Ruby will
have some difficulties to be released on all the platforms (I mean,
Windows / Linux / Mac).
I have been working for years with Ruby. Now I’m creating softwares, but
I’m stuck with Ruby 1.8.6.

If I use one method which only exists with Ruby 1.9.1 (ascii_only? by
example), my exe program will not work (because Exerb and Rubyscript2exe
are using 1.8.6).

And it’s very sad, because 1.9.1 is faster than 1.8.6, and because the
slowness of Ruby is one of its biggest problem (but I love Ruby !).

I’d like to point out that Rubyscript2exe and Exerb are the work of
volunteers. […] less than a hundred? less than 20? -
of people with experience
in Windows who are actively contributing to Ruby.

Yes, I knew it. But I didn’t know there were so few people with
experience in Windows contributing to Ruby.
And I think it’s bad, because Ruby really deserves to be working on all
platforms.

On Tue, May 19, 2009 at 9:36 PM, Marc-antoine Kruzik
[email protected] wrote:

I would create an exe file for a program written in Ruby 1.9.1.
But Rubyscript2exe and Exerb are using Ruby 1.8.7 (or 1.8.6).

OCRA works with Ruby 1.9. http://ocra.rubyforge.org/

(I forgot a CTRL+V)

Alex wrote:

fine though, why are you in need of an exe?

Because I gave my softwares to people who doesn’t have Ruby. And they
are using Windows.
So, the exe is the fastest way to release my softwares.

My main project is a software which can extract dialogs from a RPG Maker
game, and put these dialogs in a txt file.
It’s used by 20 to 50 game projects in at least 5 languages.

But I really need to use Ruby 1.9.1, because of the new String features.
I have had a lot of problems with UTF-8 and Ascii (“é” which could be
written with 1 or 2 bits).
In order to make my software compatible with other languages (such as
Japanese), I really need these features.

And fastest execution. Because it takes 20 minutes to extract dialogs
for a big project.

On Tue, 19 May 2009 14:43:10 -0500, Alex [email protected] wrote
in [email protected]:

As far as I know, there’s currently no way to generate an exe out of a ruby
1.9 script, short of packing the ruby script into the exe and calling the
external ruby interpreter. Since the ruby interpreter runs on windows just
fine though, why are you in need of an exe?

In the Windows world, it is not normal to expect end users to install
an interpreter in order to run software. Because Windows software is
almost exclusively distributed in executable binary form, that’s what
users expect.

Depending on one’s target market for an application, asking them to
alter this expectation may well result in people refusing to use the
software. Between a general lack of computer literacy and the fear of
malware, it’s a hard barrier to break.

In the future it may be possible to compile the ruby bytecode into an exe
and bundle an interpreter with it, but I’m pretty sure nothing like that
exists yet.

An alternative might be IronRuby, if the OP is willing to live with
the dependency on .NET.

Lars C. wrote:

On Tue, May 19, 2009 at 9:36 PM, Marc-antoine Kruzik
[email protected] wrote:

I would create an exe file for a program written in Ruby 1.9.1.
But Rubyscript2exe and Exerb are using Ruby 1.8.7 (or 1.8.6).

OCRA works with Ruby 1.9. http://ocra.rubyforge.org/

Do you know where I can have more informations about Ocra ?
I downloaded ocrasa, I put it in c:/ruby/bin (a 1.9.0 version) and I
tried to compile a script containing this line :

puts “Hello World”

The compilation seems to be ok (I just modified the path of my ruby dir
in rbconfig.rb “C:\LAN.…” => “C:\ruby”).
During compilation, I have had a warning because enumerable.so was not
found.

When I launch the exe file, I have an error message :
“failed to create directory”

I run on Vista, so I tried to launch the exe on XP (because the failed
creation maybe occurs because of Vista). But I have the same problem.

I looked at the code in ocrasa.rb, and I saw that the scrip use
ENV[“TEMP”] without any problem.
So, why the exe have a problem when it tries to create a folder ?

Because I suppose this bug occurs when ocra tries to extract the
contents of the exe into a temporary directory.

On May 20, 12:13 pm, Marc-antoine Kruzik [email protected]
wrote:

tried to compile a script containing this line :

I run on Vista, so I tried to launch the exe on XP (because the failed
creation maybe occurs because of Vista). But I have the same problem.

I looked at the code in ocrasa.rb, and I saw that the scrip use
ENV[“TEMP”] without any problem.
So, why the exe have a problem when it tries to create a folder ?

Because I suppose this bug occurs when ocra tries to extract the
contents of the exe into a temporary directory.

I’ve used both 1.8 and 1.9 with ocra gem without any kind of issue.

Also, running as normal user.

Maybe you’re trying to create a folder form your script?

Please try the gem version instead of the standalone one.

Charles C. wrote:

almost exclusively distributed in executable binary form, that’s what
users expect.

Except with Java. If the use does not have the proper version of the
JVM, they will get prompted (or can be, I don’t know how automatic this
is) to download a newer version.

I’ve no surveys on this, only my own experience, but I don’t think
Windows users are too spooked about having to get a more current JVM.

Depending on one’s target market for an application, asking them to
alter this expectation may well result in people refusing to use the
software. Between a general lack of computer literacy and the fear of
malware, it’s a hard barrier to break.

In the future it may be possible to compile the ruby bytecode into an exe
and bundle an interpreter with it, but I’m pretty sure nothing like that
exists yet.

JotBot, my cross-platform desktop app for time tracking, is written in
JRuby, and expects Java 1.6, and a user will get prompted to download
that if it is not available when installing JotBot.

I’ve not gotten any complaints, though that’s not to say some just gave
up and never bothered to tell me.

This may be all academic to the OP as JRuby does not fully implement
Ruby 1.9 yet.

But distributing JRuby apps as Windows exe files is certainly doable.


James B.

www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
www.neurogami.com - Smart application development

Luis L. wrote:

I’ve used both 1.8 and 1.9 with ocra gem without any kind of issue.

Also, running as normal user.

Maybe you’re trying to create a folder form your script?

Please try the gem version instead of the standalone one.

I can’t install ocra gem with Ruby 1.9.
I have this problem :

But I cheated a lot (I copied ocra gem from my Ruby 1.8.6 folder into my
Ruby 1.9.0 folder), so it works.

Now, my “puts ‘Hello World !’” is working, so I will try to compile my
software.

I installed “ruby-1.9.0-0-i386-mswin32”, but a lot of files were missing
:

  • readlines.dll
  • zlib.dll
  • libeay32.dll
  • ssleay32.dll

So I took these files from my Ruby 1.8.6 folder.

Is it okay ?

Marc-antoine Kruzik wrote:

I can’t install ocra gem with Ruby 1.9.
I have this problem :
http://i291.photobucket.com/albums/ll318/KingKadelfek/ruby190.png

Do a
gem update --system
and then try again.

I installed “ruby-1.9.0-0-i386-mswin32”, but a lot of files were missing
:

  • readlines.dll
  • zlib.dll
  • libeay32.dll
  • ssleay32.dll

So I took these files from my Ruby 1.8.6 folder.

Is it okay ?
There’s a list of links at
http://www.garbagecollect.jp/ruby/mswin32/en/documents/install.html
where to get your dlls, but I think you can copy the files from your
Ruby 1.8.

Btw, ocra works even with the mingw version of Ruby 1.9.1(-p0 and
-p129). Since the Ruby main stream is moving to mingw, you should think
about moving, too.

(sorry, I forgot again one CTRL-V)

Charles C. wrote:

On Tue, 19 May 2009 14:43:10 -0500, Alex [email protected] wrote
in [email protected]:

As far as I know, there’s currently no way to generate an exe out of a ruby
1.9 script, short of packing the ruby script into the exe and calling the
external ruby interpreter. Since the ruby interpreter runs on windows just
fine though, why are you in need of an exe?

In the Windows world, it is not normal to expect end users to install
an interpreter in order to run software. Because Windows software is
almost exclusively distributed in executable binary form, that’s what
users expect.

Depending on one’s target market for an application, asking them to
alter this expectation may well result in people refusing to use the
software. Between a general lack of computer literacy and the fear of
malware, it’s a hard barrier to break.

I will never have been able to say such a thing into english, thank you
very much.
And Ruby 1.9, it’s several thousands of files, it takes a long time to
install it… just for one program.

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

This may be all academic to the OP as JRuby does not fully implement
Ruby 1.9 yet.

But distributing JRuby apps as Windows exe files is certainly doable.

Maybe it’s doable, however, currently I tried this using different
jar2exe-converters without success.

It worked fine for other Scripting languages, but JRuby somehow did not
manage to access internal resources. I found some hint to this problem
on
the net, but had no time digging deeper.
I didn’t find a HowTo for JRuby-Exe integration, so I finally gave up on
this issue, delivering jars now.

Delivering Jars instead of Ruby-Sources would only solve part of OP’s
problem.

In current environments, where bandwith- and file-space-limits are
practically non-existing, an one-file delivery should be possible for
every
project.

IMHO, it will be a must-have in near future.

Michael B.

“Daniel S.” [email protected] schrieb im Newsbeitrag
news:[email protected]

Depending on what libraries you’re using, you could run jruby in 1.9
mode and bundle that up using the existing methods for exe-ifying a java
program (I use jarjar and launch4j, but there are other alternatives).

Hello Dan!
Is there a HowTo on the net describing how to integrate JRuby into
Windows-Exe to create a one-file delivery?
I do not want / am not able to force all users to install JRuby files on
their machines.

Michael B.

Michael Bruschkewitz wrote:

I do not want / am not able to force all users to install JRuby files on
their machines.

Look into a tool called “rawr”, which can package up JRuby + .exe into a
single distributable unit. It’s pretty nice.

  • Charlie

I would create an exe file for a program written in Ruby 1.9.1.
But Rubyscript2exe and Exerb are using Ruby 1.8.7 (or 1.8.6).

Depending on what libraries you’re using, you could run jruby in 1.9
mode and bundle that up using the existing methods for exe-ifying a java
program (I use jarjar and launch4j, but there are other alternatives).

Dan.

On Jun 3, 6:54 am, “Michael Bruschkewitz”
[email protected] wrote:

customized exports files.

It seems rawr needs Rake-files for input.
I don’t think Netbeans uses Rake-files, I don’t want to switch away from
Netbeans.

Cite from rawr-page: “It explains itself! No documentation necessary here.”
Given this, I think I will not waste my time by trying rawr-configs for
hours.

http://rawr.rubyforge.org/

Below that paragraph there is the explanation of one of the
configuration Files.

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.

Just my thoughts,

“Luis L.” [email protected] schrieb im Newsbeitrag
news:[email protected]
On Jun 3, 6:54 am, “Michael Bruschkewitz”
[email protected] wrote:

Cite from rawr-page: “It explains itself! No documentation necessary
here.”
Given this, I think I will not waste my time by trying rawr-configs for
hours.

http://rawr.rubyforge.org/

Below that paragraph there is the explanation of one of the
configuration Files.

Don’t you think I read this page, too?

It does not explain (for example):

  • if all required jars are included in resulting exe, possibly
    automatically
  • if all required ruby-libs are included in resulting exe
  • how to define additional ruby-libs to be included
  • if it’s possible to create GUI applications
  • if it’s possible to set an icon for the resulting exe
  • how to access resources from java
  • how to access location of exe-file from java
  • if it’s possible to create 64-bit applications
  • how to define main class of Java project
  • if path names are relative to current dir or root-java dir
  • if it’s necessary to compile java classes through this tool.

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?

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.
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.

“Charles Oliver N.” [email protected] schrieb im Newsbeitrag
news:[email protected]

Look into a tool called “rawr”, which can package up JRuby + .exe into a
single distributable unit. It’s pretty nice.

Hello Charles,
maybe it’s nice, but I dont know if it will fit my needs.

I have a main Netbeans-Java project which uses JRuby only as Scripting
extension for small pieces of configuration files or while creating
customized exports files.

It seems rawr needs Rake-files for input.
I don’t think Netbeans uses Rake-files, I don’t want to switch away from
Netbeans.

Cite from rawr-page: “It explains itself! No documentation necessary
here.”
Given this, I think I will not waste my time by trying rawr-configs for
hours.

Thank you, anyway.