hello everybody,
im trying to bundel a gem as a jar (nokogiri (nokogiri (1.4.2) or
hpricot-0.8.2-java) with jruby-complete-1.5.1.jar according to this
tutorial:
JRuby 1.1.6: Gems-in-a-jar.
gem list --local finds both gems but when i require one of the gems in
irb, it fails to load them always.
I have also tried it with jruby-complete-1.4.1.jar +
hpricot-0.8.2-java and hpricot-0.6.1 according to
http://kenai.com/projects/jruby/pages/Hpricot.
Does anybody have a solution for this problem? I only want to bundle
jruby-complete with gems to embed it in a java application. so i would
be satisfied with a different approach, building from source with
gems? The problem is I dont really find information on how to embed
jruby with gems in a java application.
My System is OSX 10.6.3
java version “1.6.0_20”
Java™ SE Runtime Environment (build 1.6.0_20-b02-279-10M3065)
Java HotSpot™ Client VM (build 16.3-b01-279, mixed mode)
This is what i have tried so far:
Philipp-Kleins-MacBook:jruby philipp$ java -jar
jruby-complete-1.5.1.jar -S gem install -i ./nokogiri nokogiri
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
Successfully installed weakling-0.0.4-java
Successfully installed nokogiri-1.4.2-java
2 gems installed
Installing ri documentation for weakling-0.0.4-java…
Installing ri documentation for nokogiri-1.4.2-java…
No definition for parse_memory
No definition for parse_file
No definition for parse_with
No definition for get_options
No definition for set_options
Installing RDoc documentation for weakling-0.0.4-java…
Installing RDoc documentation for nokogiri-1.4.2-java…
No definition for parse_memory
No definition for parse_file
No definition for parse_with
No definition for get_options
No definition for set_options
Philipp-Kleins-MacBook:jruby philipp$ ls
jruby-complete-1.4.1.jar jruby-complete-1.5.1.jar.bk
jruby-complete-1.5.1.jar nokogiri
Philipp-Kleins-MacBook:jruby philipp$ jar cf nokogiri.jar -C nokogiri/ .
Philipp-Kleins-MacBook:jruby philipp$ java -jar
jruby-complete-1.5.1.jar -S gem list --local
*** LOCAL GEMS ***
columnize (0.3.1)
rake (0.8.7)
rspec (1.3.0)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3.2)
sources (0.0.1)
Philipp-Kleins-MacBook:jruby philipp$ java -jar
jruby-complete-1.5.1.jar -rnokogiri.jar -S gem list --local
*** LOCAL GEMS ***
columnize (0.3.1)
nokogiri (1.4.2)
rake (0.8.7)
rspec (1.3.0)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3.2)
sources (0.0.1)
weakling (0.0.4)
Philipp-Kleins-MacBook:jruby philipp$ java -jar
jruby-complete-1.5.1.jar -rnokogiri.jar -S irb
irb(main):001:0> require ‘rubygems’
=> true
irb(main):002:0> gem ‘nokogiri’
=> true
irb(main):003:0> require ‘nokogiri’
=> false
irb(main):004:0> require ‘Nokogiri’
=> true
irb(main):005:0> require ‘open-uri’
=> true
irb(main):006:0> doc =
Nokogiri::HTML(open(‘tenderlove - Google Search’))
NameError: uninitialized constant Nokogiri
from (irb):6
irb(main):007:0> require ‘nokogiri’
=> false
irb(main):008:0> require ‘nokogiri.jar’
=> false
irb(main):009:0> quit
Philipp-Kleins-MacBook:jruby philipp$ java -jar
jruby-complete-1.5.1.jar -S gem install -i ./hpricot hpricot
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
Successfully installed hpricot-0.8.2-java
1 gem installed
Installing ri documentation for hpricot-0.8.2-java…
Installing RDoc documentation for hpricot-0.8.2-java…
Philipp-Kleins-MacBook:jruby philipp$ jar cf hpricot.jar -C hpricot/ .
Philipp-Kleins-MacBook:jruby philipp$ java -jar
jruby-complete-1.5.1.jar -rhpricot.jar -S gem list --local
*** LOCAL GEMS ***
columnize (0.3.1)
hpricot (0.8.2)
rake (0.8.7)
rspec (1.3.0)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3.2)
sources (0.0.1)
Philipp-Kleins-MacBook:jruby philipp$ java -jar
jruby-complete-1.5.1.jar -rhpricot.jar -S irb
irb(main):001:0> require ‘hpricot’
=> false
irb(main):002:0> require ‘rubygems’
=> true
irb(main):003:0> require ‘hpricot’
=> false
irb(main):004:0> gem ‘hpricot’
=> true
irb(main):005:0> Hpricot
NameError: uninitialized constant Hpricot
from (irb):5
irb(main):006:0> require ‘hpricot’
=> false
Thank you very much
Philipp Klein
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email