J
justdoit693
I've been programming java for a while now so i'm not a novice (although
this problem is making me feel like one)...heres the scenario. In fact,
i've done all this before so i'm not sure what i'm missing here.
I've got a JAR file that acts as a library that contains an interface called
com.app.CallbackInterface
I have another class that takes an implementation of a CallbackInterface in
the same JAR file and the same path.
Now i've created a test application with this basic code.
import com.app.* ;
public class MyTestApp implements CallbackInterface {
public static void main(String args[]) {
AppMonitor app = new AppMonitor(new MyTestApp()) ;
}
// callback interface methods go here...
}
The code compiles just fine but I get a NoClassDefFoundError when I try to
run the app.
Exception in thread "main" java.lang.NoClassDefFoundError:
com/app/CallbackInterface
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Of course, i've got my class path pointing to the JAR file mentioned above
(the code wouldn't compile if I didn't). FYI, i'm using ANT with a single
classpath configured and my <javac> task refers to the path by reference.
Also, just for convenience I have a run target that uses the same
classpathref for the <java> task as the <javac> task so I know they are both
using the correct classpath. I've also setup a batch file that creates the
correct classpath in case i'm messing up with ANT somehow...
I'm completely stumped at this point. What am I missing?
thanks in advance for any help.
this problem is making me feel like one)...heres the scenario. In fact,
i've done all this before so i'm not sure what i'm missing here.
I've got a JAR file that acts as a library that contains an interface called
com.app.CallbackInterface
I have another class that takes an implementation of a CallbackInterface in
the same JAR file and the same path.
Now i've created a test application with this basic code.
import com.app.* ;
public class MyTestApp implements CallbackInterface {
public static void main(String args[]) {
AppMonitor app = new AppMonitor(new MyTestApp()) ;
}
// callback interface methods go here...
}
The code compiles just fine but I get a NoClassDefFoundError when I try to
run the app.
Exception in thread "main" java.lang.NoClassDefFoundError:
com/app/CallbackInterface
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Of course, i've got my class path pointing to the JAR file mentioned above
(the code wouldn't compile if I didn't). FYI, i'm using ANT with a single
classpath configured and my <javac> task refers to the path by reference.
Also, just for convenience I have a run target that uses the same
classpathref for the <java> task as the <javac> task so I know they are both
using the correct classpath. I've also setup a batch file that creates the
correct classpath in case i'm messing up with ANT somehow...
I'm completely stumped at this point. What am I missing?
thanks in advance for any help.