Warbler-built code containing certain JRuby gems doesn't appear to work

I noticed that some of my more basic code built with warbler executed
just fine, while other programs simply didn’t work. After a bit of trial
and error and playing with the code, this is what I discovered:

The following code works fine when built with warbler:


require ‘rubygems’

puts “Hello World”
gets


However, if I add ANY of the following ruby gems to the above code and
build it with warbler, I am unable to run the resulting JAR file or the
subsequently converted EXE file.


spreadsheet
ole/storage
jruby-win32ole


Has anyone else here ever faced this issue and does anyone know whether
there is a workaround or a solution for this?

Just bumping this thread in case anyone knows the solution to this.

On Thu, Feb 2, 2012 at 2:14 PM, Farsheed B. [email protected]
wrote:


Has anyone else here ever faced this issue and does anyone know whether
there is a workaround or a solution for this?

Can you post versions of Warbler, JRuby, etc. and also post the output
of “jar tf mywar.war”?

/Nick

Nick S. wrote in post #1047451:

Can you post versions of Warbler, JRuby, etc. and also post the output
of “jar tf mywar.war”?

/Nick

Warbler Version: 1.3.2
JRuby Version: 1.5.1

I’m not sure what you mean by [post the output of “jar tf mywar.war”].
I’ve attached the JAR file created by warbler along with this post for
your reference if that helps.

On Thu, Feb 23, 2012 at 8:02 PM, Farsheed B. [email protected]
wrote:

I’m not sure what you mean by [post the output of “jar tf mywar.war”].
I’ve attached the JAR file created by warbler along with this post for
your reference if that helps.

Attachments:
http://www.ruby-forum.com/attachment/7093/ExcelRubyPractice.jar

the gem spreadsheet for example is not inside your jar file.

2 possible solutions:

  • tell warbler to include them (look at the man page, I believe it’s
    possible)
  • include gems and specifications inside the jar file itself: you need
    to create gems and specifications folders on top, and put inside
    respective folders from your gems and specs. This is what I usually
    do.


Christian

Christian MICHON wrote in post #1048510:

the gem spreadsheet for example is not inside your jar file.

2 possible solutions:

  • tell warbler to include them (look at the man page, I believe it’s
    possible)
  • include gems and specifications inside the jar file itself: you need
    to create gems and specifications folders on top, and put inside
    respective folders from your gems and specs. This is what I usually
    do.


Christian

Thanks for the solutions, although I’m a complete programming noob and
can’t seem to figure out how to implement them. Do I need to copy-paste
the gems somewhere? If so, how?

I looked online and found the following code:


source “http://gems.github.com
gem “spreadsheet”

Do I need to add this somewhere, say, in the spec folder? If so, what
should I name the file in that folder and is there anything else to be
done?

Zijad Purkovic wrote in post #1048720:

You can try with something like this in your warble.rb file:

config.gems[“actionpack”] = “2.3.8”

Obviously, change the gem and version to match your gem.

On Fri, Feb 24, 2012 at 11:38 PM, Farsheed B.
[email protected] wrote:

do.
source “http://gems.github.com


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Zijad Purkovi
Dobrovoljnih davalaca krvi 3/19, Zavidovii
061/ 690 - 241

I added the details in the warble.rb file but to no avail. I’m not sure
whether I did it correctly so I’ve attached the file along with this
post. The added code is at the end of the file.

I still cannot see the gems in the JAR file after recreating it.

You can try with something like this in your warble.rb file:

config.gems[“actionpack”] = “2.3.8”

Obviously, change the gem and version to match your gem.

On Fri, Feb 24, 2012 at 11:38 PM, Farsheed B.
[email protected] wrote:

do.
source “http://gems.github.com


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Zijad Purkovi
Dobrovoljnih davalaca krvi 3/19, Zavidovii
061/ 690 - 241