ClassNotFoundException with URLClassLoader in classes.jar (java.net package)

tom picture tom · Dec 1, 2010 · Viewed 7.5k times · Source

On Eclipse Galileo, got the following ClassNotFoundException when doing Debug As/Web Application. But works just fine when doing Run As/Web Application.

I was given message that "The source attachment does not contain the source for the file URLClassLoader.class. You can change the source attachment by clicking the Change Attached Source below:"

In the project window, it seems that the URLClassLoader class is from Java.net package, which is from /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar.

I found the jar on the machine, what else I am missing? why it's debug only issue?

Could it be possible that the JRE system library that I have on my iMac 10.6.5 machine is outdated? Or somehow install/unstall of some jar/package caused the issue?

This is what I have - JRE System Library [JVM 1.6.0 (MacOS X Default)] - would update it help fixing the issue? but how to get it updated?

Please help!

com.google.appengine.tools.development.DevAppServerMain at localhost:57873 
 Thread [main] (Suspended (exception ClassNotFoundException)) 
  Launcher$ExtClassLoader(URLClassLoader).findClass(String) line: 207 
  Launcher$ExtClassLoader.findClass(String) line: 229 
  Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: 307 
  Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: 296 
  Launcher$AppClassLoader.loadClass(String, boolean) line: 301 
  Launcher$AppClassLoader(ClassLoader).loadClass(String) line: 248 
  InstrumentationImpl.loadClassAndStartAgent(String, String, String) line: 280 
  InstrumentationImpl.loadClassAndCallPremain(String, String) line: 338 
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java (Nov 30, 2010 9:40:41 PM) 

Answer

user591593 picture user591593 · Aug 4, 2011

Perhaps you need to install JDK which has complete sources? Refer to Apple website to download the latest JDK, might need an Apple ID.

After that change eclipse's java runtime accordingly to use the new installed JDK:

enter image description here

And re-build your project: Project -> Source -> Clean-up