Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 282
  • Last Modified:

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
0
meetgopi
Asked:
meetgopi
  • 6
  • 4
  • 3
1 Solution
 
CEHJCommented:
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
0
 
objectsCommented:
try running it using:

java -classpath c:\iftmbf;c:\iftmin\anllib.jar  InterchangeStatus
0
 
CEHJCommented:
IOW, do what i just said ...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
meetgopiAuthor Commented:
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.
0
 
CEHJCommented:
You need to specify the classpath at execution time too
0
 
objectsCommented:
>  when i try to execute i am getting this error.

try the command I posted above, and tell me what errors you get
0
 
objectsCommented:
Another way would be to copy the jar fiel to the ext directory of your jre(s)
0
 
meetgopiAuthor Commented:
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.
0
 
CEHJCommented:
>>C:\iftmin\anl.jar

should be

C:\iftmin\anllib.jar
0
 
meetgopiAuthor Commented:
sorry that's a typing mistake during the posting
0
 
objectsCommented:
> 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
0
 
CEHJCommented:
>> sorry that's a typing mistake during the posting

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

Probably too late, but i don't agree
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 6
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now