public class Mammal {
static
{ int a = 1;
assert a == 1;
System.out.println("mammal initialized");
}
}
package coff2;
import coff.Mammal;
public class Dog extends Mammal {
@SuppressWarnings("unused")
public static void main(String[] args) {
assert (1 != 0) : "this should never appear...";
System.out.println("Dog extends Mammal");
}
}
Caused by: java.lang.ClassNotFoundException: coff2.Dog
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)
Exception in thread "main"
Does this have anything to do with Eclipse? This looks like a general
problem running a java jar. This forum is for Eclipse JDT (compilation)
problems/questions. For general java questions you need to go somewhere
else.
Well, the attached rar contains a proper Eclipse / JDT project.
If the exception occurs when running the application inside the IDE, then something's fishy in JDT/Debug.
Otherwise, (if exception ocurrs outside Eclipse) I concur that the JDT forum is not a likely place to get help for this issue.
I wouldn't say it's a "proper" project--you have two JREs on the Java Build Path, and unless you've actually set up a 1.7 JRE in the preferences, your build path will be considered broken. An erroneous build path will, by default, abort the build and leave you with no class files, hence the Error at runtime.