Problems loading resources and classes from within jar

Hi all,

I have written a JRuby app that removes all locations that have been
tracked in your iphone backup files and modifies them so no future
recording can take place. I want to distribute as a single executable
jar file, but I’ve found that on some machines it works and others it
doesn’t.

The problem is that the “launcher” cannot always load other ruby and
resource files from within the jar.

There appears to be no rhyme or reason to which machines can run it and
which can’t. I’ve found that some OSX machines with the exact same JDK
version can execute it, and others can’t. Windows universally does not
work.

I just logged the bug here: http://jira.codehaus.org/browse/JRUBY-5749
and the code to reproduce is here:
https://github.com/lukegalea/jrubyjarproblem

This is very time sensitive given the media attention around
“LocationGate”. I really want to keep this as JRuby, but if I can’t get
it resolved soon I’ll have to rewrite it in pure Java.

Thanks in advance for any help you can offer.

Luke Galea
VP Research and Development, Avid Life Media
647-226-2345
[email protected]

On Apr 28, 2011, at 13:12 , Luke Galea wrote:

This is very time sensitive given the media attention around “LocationGate”. I
really want to keep this as JRuby, but if I can’t get it resolved soon I’ll have
to rewrite it in pure Java.

Thanks in advance for any help you can offer.

Hi Luke,

Does using File.expand_path help?

A_FILE = File.expand_path("…/…/support/afile.txt", FILE)

/Nick

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs