Forum: JRuby Classpath Ignored in Command Line

Posted by Paul F Fraser (Guest)
on 2010-03-09 02:45
(Received via mailing list)
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
Posted by Hassan Schroeder (Guest)
on 2010-03-09 03:46
(Received via mailing list)
On Mon, Mar 8, 2010 at 5:43 PM, Paul F Fraser <paulf@a2zliving.com> 
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 Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Paul F Fraser (Guest)
on 2010-03-09 04:09
(Received via mailing list)
Hassan Schroeder 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
Posted by Vladimir Sizikov (Guest)
on 2010-03-09 08:40
(Received via mailing list)
Hi Paul,

On Tue, Mar 9, 2010 at 2:43 AM, Paul F Fraser <paulf@a2zliving.com> 
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 :) 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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.