gpt4 book ai didi

java - 使用 AST 时在 eclipse 中出现 NoClassDefFoundError

转载 作者:行者123 更新时间:2023-11-30 07:20:28 25 4
gpt4 key购买 nike

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

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

代码一开始就失败了:

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

我也尝试将所有 jar 添加到我的计算机中,但无济于事。有什么想法吗?

堆栈跟踪:

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

最佳答案

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

关于java - 使用 AST 时在 eclipse 中出现 NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13993241/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com