2

当尝试在 Eclipse 的 java 项目中使用 AST 时,我收到此错误消息是运行时:线程“main”java.lang.NoClassDefFoundError 中的异常:org/eclipse/core/runtime/IAdaptable

我尝试将 core.runtime jar 添加到构建路径中,但这没有帮助。

代码一开始就失败了:

AST ast = AST.newAST(AST.JLS4);

我还尝试在我的计算机中添加所有罐子,但无济于事。有任何想法吗?

堆栈跟踪:

Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/IAdaptable
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    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$000(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.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    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$000(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 testRun.main(testRun.java:44)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.IAdaptable
    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)
    ... 25 more
4

1 回答 1

4

除了添加org.eclipse.jdt.core_[version_number].jar到您的构建路径之外,您还需要添加org.eclipse.equinox.common_[version_number].jar.

于 2013-02-27T11:13:27.200 回答