Classpath Ignored in Command Line

java -jar jruby-complete-1.5.0.dev.jar -J-cp h2-latest.jar main.rb
fails with jruby: unknown option -J-cp
also
java -cp h2-latest.jar -jar jruby-complete-1.5.0.dev.jar main.rb
ignores the classpath

How best to get the driver jar onto the java classpath as returned by

require ‘java’
puts java.lang::System.get_property(“java.class.path”)

placed at the start of main.rb

This problem has been discussed previously, but I still do not have a
working solution.
If run in netbeans, with the path to the h2 jar set in the project java
runtime libraries, the java classpath is set with the h2 jar added and
it works.

Thanks
Paul F Fraser


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Mon, Mar 8, 2010 at 5:43 PM, Paul F Fraser [email protected]
wrote:

How best to get the driver jar onto the java classpath

I just start things up as e.g.

CLASSPATH=lib/mysql-connector-java.jar jruby script/console …

which has worked very reliably.

FWIW,

Hassan S. ------------------------ [email protected]
twitter: @hassan


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hassan S. wrote:

which has worked very reliably.

FWIW,

Thanks Hassan,
Works fine with installed JRuby.
Question now is, can jruby complete be handled in a similar manner?
I have tried a few variations, but have not found a solution for jruby
complete yet.

Paul


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi Paul,

On Tue, Mar 9, 2010 at 2:43 AM, Paul F Fraser [email protected]
wrote:

java -jar jruby-complete-1.5.0.dev.jar -J-cp h2-latest.jar main.rb
fails with jruby: unknown option -J-cp

Yes, -J-cp is handled by jruby launcher, and doesn’t work with java -jar
… .

also
java -cp h2-latest.jar -jar jruby-complete-1.5.0.dev.jar main.rb
ignores the classpath

Yes, this is a java limitation. Once -jar is set, java ignores -cp
options.

How best to get the driver jar onto the java classpath as returned by

You have to set CLASSPATH variable before you launch jruby-complete.

As Hassan mentioned you might do that like this:

CLASSPATH=path/to/your.jar java …

Or, you could just

export CLASSPATH=path/to/your.jar

and then

java -jar jruby-complete.jar …

There is a third option as well :slight_smile: Don’t use -jar and use:

java -cp h2-latest.jar:jruby-complete-1.5.0.dev.jar org.jruby.Main
main.rb

Here you set the classpath and then invoke the main JRuby class
directly.

Thanks,
–Vladimir

works.
http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

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