From: Charles Oliver Nutter Date: 2010-05-26T04:56:50+09:00 Subject: Re: Ruby one-file launcher that sets up environment? On Sun, May 23, 2010 at 5:18 PM, Michal Suchanek wrote: > Well, actually it does not. > > If I wanted to distribute the script in multiple files then > distributing it with a launcher would be just fine and would not > require the user of the script to have administrative privileges to > install the script in a system directory nor the additional knowledge > how to make it effective without restarting his session. > > However, I was aiming for one self-contained example which is easy to > distribute so I wanted one file. You can generally get by using the runtime CLASSPATH in JRuby: require 'java' $CLASSPATH << 'somefile.jar' This doesn't always work, since it's using a child classloader in JRuby to handle all the classpath entries, but it often works well enough for a simple self-contained app. Alternatively you can just throw everything in the same jar if there aren't file conflicts... - Charlie