Valeri
asked on
java.lang.NoClassDefFoundError error!
Hi all,
I'm trying to run my own .jar file, it refers classes collected in another jar file. Both of this ".jar" files are in same directory. When all of this classes were under developing everything was ok, but now, when I separated this classes in different jars, there is something wrong! I really don't know what is it!!!!!!!!!!!!!
I'm trying with this line : "java -jar my.jar someparameters"
My classpath also seems ok, I added "." at the begining of my classpath as well, but I'm still getting this error : Exception in thread "main" java.lang.NoClassDefFoundE rror: sss/com/DocListener.
Any suggestions?
Thanks in advance!
I'm trying to run my own .jar file, it refers classes collected in another jar file. Both of this ".jar" files are in same directory. When all of this classes were under developing everything was ok, but now, when I separated this classes in different jars, there is something wrong! I really don't know what is it!!!!!!!!!!!!!
I'm trying with this line : "java -jar my.jar someparameters"
My classpath also seems ok, I added "." at the begining of my classpath as well, but I'm still getting this error : Exception in thread "main" java.lang.NoClassDefFoundE
Any suggestions?
Thanks in advance!
try:
java -classpath putHereTheOtherjarFile -jar my.jar someparameters
java -classpath putHereTheOtherjarFile -jar my.jar someparameters
about same time
:)
:)
ASKER
It also does not works! I tried it as well, but I forgot to mention this in my question. When all of this classes are in same jar they work fine, but now they don't work. It seems like problem of class loader or something else?!?!
I don't know!
I don't know!
> sss/com/DocListener
the noclassdeffounderror, is in A.jar or in B.jar ???
java -classpath A.jar -jar B.jar <someparameters>
the noclassdeffounderror, is in A.jar or in B.jar ???
java -classpath A.jar -jar B.jar <someparameters>
Does you jar have the file DocListener?
What happens if you do (assumin *nix):
jar -tfv <your jar> | grep DocListener
What happens if you do (assumin *nix):
jar -tfv <your jar> | grep DocListener
ASKER
The DocListener class is in jar A. Yes, the jar A contains DocListener class, I checked this...
Can you tell me where *exactly* the A.jar file is, the B.jar file is, what is your current working directory and the command you are using to run them?
If you open the A.jar do you find DocListener.class in sss/com/ directory?
ASKER
Yes, my class exists in A.jar.
I'm using this command : "java -classpath A.jar -jar B.jar someparameters" . The class with main method is in B.jar and java is looking for the class in A.jar. The error that I'm getting is : Exception in thread "main" java.lang.NoClassDefFoundE rror: sss/com/DocListener. Both of the jar files are in the project directory!
I'm using this command : "java -classpath A.jar -jar B.jar someparameters" . The class with main method is in B.jar and java is looking for the class in A.jar. The error that I'm getting is : Exception in thread "main" java.lang.NoClassDefFoundE
Ok, but if you open the A.jar do you find DocListener.class in the directory
sss/com/
?
sss/com/
?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yeah! :-)))))))))))))))))))))))) )))))))))) ))
"objects" is always the right person! Many, many, many thanks objects! ;-)
"objects" is always the right person! Many, many, many thanks objects! ;-)
glad we could help resolve your problem :)
java -classpath <your other jar file> -ja my.jar <some parameters>