简体   繁体   English

使用JDEE从emacs内部运行Java应用会抛出NoClassDefFoundError

[英]Running Java app from inside emacs using JDEE throws NoClassDefFoundError

I have configured JDEE in emacs. 我已经在emacs中配置了JDEE。 But when I try to run any App, it throws NoClassDefFoundError . 但是,当我尝试运行任何App时,都会抛出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. 另外,在这台机器上,我安装了java-6-openjdk。 I had configured JDEE on my home computer which has sun java jdk and there are no such problems there. 我已经在装有sun java jdk的家用计算机上配置了JDEE,并且那里没有此类问题。

Other than this, features such as code completion, generation etc work fine. 除此之外,代码完成,生成等功能都可以正常工作。

How do I solve this? 我该如何解决? Is this due to open jdk ? 这是由于打开jdk吗?

I am using a Ubuntu 10.04 desktop. 我正在使用Ubuntu 10.04桌面。

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 谢谢

From the question, it sounds as if the JDEE configuration is not complete when it comes to setting up the command to be launched when running the Java App. 从这个问题来看,当设置运行Java App时要启动的命令时,听起来JDEE配置似乎不完整。

If the same Java App can be run from the terminal with no issues, OpenJDK is not causing the trouble, I'd wager. 我敢打赌,如果可以从终端上运行同一Java应用程序而没有问题,那么OpenJDK不会造成麻烦。

Perhaps you copied over from the other computer the JDEE configurations and did not adopt them for the new computer that has OpenJDK. 也许您是从另一台计算机复制了JDEE配置,而没有将它们用于具有OpenJDK的新计算机。

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/". 您试图从“ / home / vineet / java / KodeJava / src / org / kodeplay / kodejava /”目录中运行,但是为了在类路径上找到您的类,您应该从“ / home / vineet / java / KodeJava / src /”。 Probably need to configure the "jde-run-working-directory" variable. 可能需要配置“ jde-run-working-directory”变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM