views:

11

answers:

1

Hi, I am currently working on integrating Java application General Architecture For Text Engineering (GATE) with Rails application using Jruby architecture. When we worked on integrating Jruby with log4j, I am getting following error :

0 [main] DEBUG Main.class - Hello world gate/Gate.java:80:in <clinit>': java.lang.NoClassDefFoundError: org/apache/log4 j/Logger (NativeException) from gateapp/Main.java:86:inmain' from test.rb:12

test.rb is the name of ruby program.

I tried importing all the log4j apache library, included the class file also in the test.rb file.

When I run the java program alone its running fine. But when I generate the jar file and include them in ruby file (test.rb) , I am getting error that

java.lang.NoClassDefFoundError: org/apache/log4j/Logger (NativeException) problem is occuring. How to deal with this problem ?

Can anyone help me out over this issue ?

Thank you Prasanna

A: 

You need to make sure the log4j JAR file is in your classpath. One way to do this is to set the CLASSPATH variable in your environment. Another way would be to call require in your ruby code like

  require "/some/path/MyStuff.jar" 
Rob Di Marco