Link to home
Start Free TrialLog in
Avatar of meetgopi
meetgopi

asked on

java.lang.NoClassDefFoundError: com/anl/db/dbase

Hi,

I am getting Class not found exception. the details are i have jar file called anllib.jar located in c:\iftmin directory, i am using this jar file in a program called InterchangeStatus.java located in c:\iftmbf, when i try to run this program i am getting the following exceptions.

Exception in thread "main" java.lang.NoClassDefFoundError: com/anl/db/dbase
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        at InterchangeStatus.init(InterchangeStatus.java:221)
        at InterchangeStatus.main(InterchangeStatus.java:542)

Thanks in advance
GOpi
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

You need to have

c:\iftmin\anllib.jar

in the classpath and make sure you've got the imports right as

>>com/anl/db/dbase

looks like you might have defined that one wrong
try running it using:

java -classpath c:\iftmbf;c:\iftmin\anllib.jar  InterchangeStatus
IOW, do what i just said ...
Avatar of meetgopi
meetgopi

ASKER

Thanks CEHJ, I checked everything it is ok. dbase is a java file located in anllib.jar under the directory structure com.anl.db and i have specified the class path to c:\iftmin\anllib.jar, previously i was getting error during compilation, it was solved. when i try to execute i am getting this error.
You need to specify the classpath at execution time too
>  when i try to execute i am getting this error.

try the command I posted above, and tell me what errors you get
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Object, i have tried in all the possiblities of your suggestion.

java -classpath C:\IFTMBF;C:\iftmin\anl.jar;C:\iftmin\jtds-1.0.2.jar;C:\iftmin\twz1.jar InterchangeStatus "%1" "%2"

i am getting the same error. i cannot copy that anllib.jar file to ext direc because this is common jar file for lot of applications.
>>C:\iftmin\anl.jar

should be

C:\iftmin\anllib.jar
sorry that's a typing mistake during the posting
> java -classpath C:\IFTMBF;C:\iftmin\anl.jar;C:\iftmin\jtds-1.0.2.jar;C:\iftmin\twz1.jar InterchangeStatus "%1" "%2"

Thats not what I posted above :)

java -classpath c:\iftmbf;c:\iftmin\anllib.jar  InterchangeStatus

If you need any other jars add them on

> i cannot copy that anllib.jar file to ext direc because this is common jar file for lot of applications.

Thats a good readon *for* copying it to the ext directory.,
That way it will be available to all apps
>> sorry that's a typing mistake during the posting

Don't type - paste ;-)
>> Accept: objects {http:#14015296}

Probably too late, but i don't agree