0

I am trying to create an instance of a java .class file (Byte code of a java code). But when i do so i get an error as follows :-

Exception in thread "main" java.lang.NoClassDefFoundError: SamplePro
at com.sample.testenvironment.Test.getTest(Test.java:29)
at com.sample.testenvironment.Test.main(Test.java:42)
Caused by: java.lang.ClassNotFoundException: SamplePro
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)
... 2 more

I am trying to create an instance of SamplePro. And I have attached the .class file of SamplePro to the class library of the project in which I am trying to create its instance.

JITHIN_PATHROSE
  • 1,134
  • 4
  • 14
  • 29

1 Answers1

1

This can happen you class may depends on some other classes. And those classes are available during compile time and those are may be missing during run time. And you can look up some solutions Click here!

Community
  • 1
  • 1
mgr
  • 641
  • 1
  • 8
  • 23