Search code examples
javaemacsjde

Running Java app from inside emacs using JDEE throws NoClassDefFoundError


I have configured JDEE in emacs. But when I try to run any App, it throws NoClassDefFoundError . Upon compilation, although a class file is created, it only shows the buffer for sometime and then closes it.

The same files if compiled and run from the terminal work perfectly fine.

Also, on this machine I have java-6-openjdk installed. I had configured JDEE on my home computer which has sun java jdk and there are no such problems there.

Other than this, features such as code completion, generation etc work fine.

How do I solve this? Is this due to open jdk ?

I am using a Ubuntu 10.04 desktop.

This is the stack trace

cd /home/vineet/java/KodeJava/src/org/kodeplay/kodejava/
/usr/lib/jvm/java-6-openjdk/bin/java org.kodeplay.kodejava.EmacsTest

Exception in thread "main" java.lang.NoClassDefFoundError: org/kodeplay/kodejava/EmacsTest
Caused by: java.lang.ClassNotFoundException: org.kodeplay.kodejava.EmacsTest
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: org.kodeplay.kodejava.EmacsTest. Program will exit.

Process org.kodeplay.kodejava.EmacsTest exited abnormally with code 1

Thanks


Solution

  • something in your config is wrong. you are trying to run from the "/home/vineet/java/KodeJava/src/org/kodeplay/kodejava/" directory, but in order to find your class on the classpath, you should be running from "/home/vineet/java/KodeJava/src/". Probably need to configure the "jde-run-working-directory" variable.