0
votes

Hi all
Hi I am using Netbeans IDE 6.9.1. I created a project Example1 and defined a class Example1Sample which has a display().
I created another project Example2 and defined a class Example2Sample and in this class I created a main() in which i am calling the display() method of Example1Sample, ( I added Example1.jar in classpath )I works fine when i run it from the Netbeans IDE.
But when i created jars( using Netbeans IDE) and tryed to run the it did not work and giving the exception that

Exception in thread "main" java.lang.NoClassDefFoundError: com/example1/ExamSample
        at com.example2.Example2Sample.main(Example2Sample.java:20)
Caused by: java.lang.ClassNotFoundException: com.example1.Example1Sample
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 1 more

What can be the problem and how can i remove that.

Thanks

1

1 Answers

0
votes

Netbeans creates manifest.mf file that sets the jars in the classpath. if the jars are not found in the structure as mentioned in that then it gives such errors. To solve the problems once you might look in to the manifest.

Thanks