Import problems with some classes

I’m using JRuby 1.1.4 to test my Java code but I have problems importing
some
classes that I know exist in the required jar file. I have the following
code:

require ‘java’
require ‘<my_path>/dbunit-2.2.3.jar’
import ‘org.dbunit.database.IDatabaseConnection’ # This works
import ‘org.dbunit.database.DatabaseConnection’ # But not this one!!!

When I check dbunit.jar I can see that the class
org.dbunit.database.DatabaseConnection exists in the jar file. I got
this
problem with some other classes from this jar file.

View this message in context:
http://www.nabble.com/import-problems-with-some-classes-tp19429886p19429886.html
Sent from the JRuby - User mailing list archive at Nabble.com.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I think I know what the problem is. The classes that I couldn’t import
from
the jarfile had dependencies to other classes that didn’t exist in the
jarfile. The classes that I could import didn’t have any external
dependencies.

nguyenlinh wrote:

`eval’
C:/Program/jruby-1.1.4/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:81:in
Thanks,
Linh


View this message in context:
http://www.nabble.com/import-problems-with-some-classes-tp19429886p19435104.html
Sent from the JRuby - User mailing list archive at Nabble.com.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

No, I was wrong. I still don’t know why JRuby can not import some
classes
from a jarfile :frowning:
I’ve been searching the web for this kind of problem but it seems like
no
one else had it before.

nguyenlinh wrote:

I’m using JRuby 1.1.4 to test my Java code but I have problems importing
same problem with some other classes from this jar file.
`include_class’


View this message in context:
http://www.nabble.com/import-problems-with-some-classes-tp19429886p19435302.html
Sent from the JRuby - User mailing list archive at Nabble.com.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi,
can You use this class in pure java envorenement? I mean short main
method with only this jar added to path?
I’ve never had such an issue so i don’t have any other clue how to cope
with it.

Best greetings,
Pawe³ Wielgus.

2008/9/11 nguyenlinh [email protected]:

This Java code compiles and runs:

import org.dbunit.database.DatabaseConnection;
class Test {
public static void main(String[] args) {}
}

This is how I compile it:
javac -classpath c:\test\lib\dbunit-2.2.3.jar Test.java

and this is how I run it:
java -classpath .;c:\test\lib\dbunit-2.2.3.jar Test

however, if I change to:
import org.dbunit.database.DatabaseConnection;
class Test {
public static void main(String[] args) {
new DatabaseConnection(null);
}
}
I can still compile it, but when I run it I get:
Exception in thread “main” java.lang.NoClassDefFoundError:
org/slf4j/LoggerFactory
at
org.dbunit.database.AbstractDatabaseConnection.(AbstractDatabaseConnection.java:46)
at Test.main(Test.java:4)

The org.slf4j.LoggerFactory class is not in dbunit-2.2.3.jar so I guess
this
is the reason why I can’t import from JRuby. The import method in JRuby
probably do a lot more than the Java import.

Paweł Wielgus wrote:

2008/9/11 nguyenlinh [email protected]:

from the jarfile had dependencies to other classes that didn’t exist in

following code:
same problem with some other classes from this jar file.
`include_class’

http://xircles.codehaus.org/manage_email


View this message in context:
http://www.nabble.com/import-problems-with-some-classes-tp19429886p19436249.html
Sent from the JRuby - User mailing list archive at Nabble.com.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email