Dave Reynolds wrote:
> On Thu, 2011-12-08 at 19:35 +0000, Damian Steer wrote: 
>> On 8 Dec 2011, at 18:45, Paolo Castagna wrote:
>>
>>> How can I setup the classpath for the jruby command?
>> From within jruby you can use:
>>
>> $CLASSPATH << 'path/to/some.jar'
>>
>> Since you want to use maven try the (very temperamental) gem / maven bridge:
>>
>> $ gem install mvn:com.hp.hpl.jena:jena -v 2.6.4
>> Successfully installed mvn:com.ibm.icu:icu4j-3.8.0-java
>> Successfully installed mvn:com.hp.hpl.jena:iri-0.8.0-java
>> Successfully installed mvn:xml-apis:xml-apis-1.4.01-java
>> Successfully installed mvn:xerces:xercesImpl-2.10.0-java
>> Successfully installed mvn:com.hp.hpl.jena:jena-2.6.4-java
>> 5 gems installed
>> $ irb
>> jruby-1.6.5 :001 > require 'java'
>>  => true 
>> jruby-1.6.5 :002 > require 'rubygems'
>>  => true 
>> jruby-1.6.5 :003 > require 'mvn:com.hp.hpl.jena:jena'
>>  => true 
>> jruby-1.6.5 :004 > java_import 'com.hp.hpl.jena.rdf.model.ModelFactory'
>>  => Java::ComHpHplJenaRdfModel::ModelFactory 
>> jruby-1.6.5 :005 > ModelFactory.create_default_model
>>  => #<Java::ComHpHplJenaRdfModelImpl::ModelCom:0x28bd36fa> 
>>
>> (note that I'm using jruby via rvm here. You might want to use jruby -S gem 
>> install .... and jirb)
> 
> +1 to using rvm to manage rubies.
> 
> Two other approaches to jruby/jena combination:
> 
> For my stuff have jruby as an OSGi bundle (it already is and indeed has
> some builtin tools to access other bundles), and a packaged jena bundle,
> then load both into my OSGi runtime. No Maven required. Not using that
> for command line stuff though.
> 
> The alternative is to package jena as a gem and I believe Ian has at
> least experimented with that.

Thanks Dave,
I'll keep your suggestions and recommendations in mind.

Since I am just starting with JRuby, this is a good enough starting point
for me and I can see how to package/distributed a "self-contained" distribution
which (given a JVM and JRuby) will work out-of-the-box with unzip and run.

Paolo

> Dave
> 
> 

Reply via email to