Hello,
I was playing to load my own Java code in JRuby, but my little example
does not work and I do not understand why.
public class Test02 {
public void output() {
System.out.print("From Java");
}
}
To create the jar archive I use “jar cf Test02.jar Test02.class”.
require 'java'
require 'Test02.jar'
test = Test02.new()
test.output
When I start “jruby Test02.rb” I always get this error:
/home/mitlox/jruby-1.1.4/lib/ruby/site_ruby/1.8/builtin/javasupport.rb:1:in
`const_missing’: uninitialized constant Test02 (NameError)
from Test02.rb:6
Perhaps I must set classpath variable but I have no idea how. Maybe do
you any idea what I did wrong with my little example?
When I start “jruby Test02.rb” I always get this error:
/home/mitlox/jruby-1.1.4/lib/ruby/site_ruby/1.8/builtin/javasupport.rb:1:in
`const_missing’: uninitialized constant Test02 (NameError)
from Test02.rb:6
Perhaps I must set classpath variable but I have no idea how. Maybe do
you any idea what I did wrong with my little example?