将处理库导入eclipse时无法编译 [英] Cannot compile when importing Processing library into eclipse
问题描述
我正在尝试使用eclipse中的Processing库来构建程序。该过程应该相对简单,但是我什至不能编译一个空的处理程序。我不确定问题可能与我的类路径有关。我试图导入处理库并在Eclipse和IntelliJ上多次编写简单程序,但都没有运气。
I am trying to build a program using the Processing library in eclipse. The process should be relatively straightforward but I cannot compile even an empty processing program. I think the problem may be something to do with my classpaths, I'm not sure. I have attempted to import the processing library and write the simple program several times on both Eclipse and IntelliJ with no luck.
这是程序:
import processing.core.PApplet;
public class Processing extends PApplet {
public static void main(String[] args) {
PApplet.main("Processing", args);
}
}
这些是我得到的错误:
These are the errors I get:
java.lang.NoClassDefFoundError: com/apple/eawt/QuitHandler
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3139)
at java.base/java.lang.Class.getMethodsRecursive(Class.java:3280)
at java.base/java.lang.Class.getMethod0(Class.java:3266)
at java.base/java.lang.Class.getMethod(Class.java:2063)
at processing.core.PApplet.runSketch(PApplet.java:10716)
at processing.core.PApplet.main(PApplet.java:10513)
at Processing.main(Processing.java:6)
Caused by: java.lang.ClassNotFoundException: com.apple.eawt.QuitHandler
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
... 8 more
我已经卸载了Java JDK并重新安装了它,但没有任何区别。在这个问题上的任何帮助将不胜感激,我似乎无法在网上找到其他人也有完全相同的问题。
I've uninstalled the java JDK and reinstalled it but it did not make a difference. Any help on this issue would be greatly appreciated, I cant seem to find anyone else online with the exact same problem.
推荐答案
I升级到JDK 9后遇到了完全相同的问题。我在这里将其报告为问题( https:/ /github.com/processing/processing/issues/5371 ),并收到有关处理3与v9不兼容的确认。目前,唯一的解决方法是降级到v8。
I had the exact same problem after upgrading to JDK 9. I reported it as an issue here (https://github.com/processing/processing/issues/5371), and received confirmation that Processing 3 is incompatible with v9. For now, the only workaround is to downgrade to v8.
这篇关于将处理库导入eclipse时无法编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!