Tutorial :Trying to load .class files in Eclipse


For a class we were given a bunch of .class files that we are supposed to use. I have them located in a folder called lib. I think I added the folder correctly to the build path correctly since a folder titled "Reference Libraries" appeared under my Project pane with a folder called lib containing all of the class files.

The problem I'm getting now is that when I try to compile the incomplete code, I get

  Exception in thread "main" java.lang.NoClassDefFoundError: Unearthed/GPRFrame   at GPR.main(GPR.java:18)  Caused by: java.lang.ClassNotFoundException: Unearthed.GPRFrame   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)   ... 1 more  

I have no idea what to do here. I just want to load the .class files so that I can continue with my project. Thanks in advance guys!

Edit: I tried putting the files in a folder lib\Unearthed and adding that to the build path but I still got the same error. I'm using eclipse to compile and run the code.


Assuming that the class is called:


That would mean GPRFrame.class should be in lib\Unearthed not lib\


Are you compiling the code outside of eclipse? if yes then you have to add the lib to your classpath javac -cp lib .... if not, then i'm not so sure, eclipse should of complained with some red marks saying that it could find the class that you are using.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »