gpt4 book ai didi

java - 'java.lang.NoSuchFieldError : ignoreMethodBodies' Exception while creating AST

转载 作者:行者123 更新时间:2023-12-01 15:27:46 24 4
gpt4 key购买 nike

将 java 源代码传递给下面提到的代码时,我遇到异常并且不知道如何解决此问题。请让我知道我错在哪里/任何替代解决方案......

源代码:

char[] source = resultEntryIndustry.text.toCharArray();
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(source);
Map options = JavaCore.getOptions();
JavaCore.setComplianceOptions(JavaCore.VERSION_1_5, options);
parser.setCompilerOptions(options);
CompilationUnit cUnit = (CompilationUnit) parser.createAST(null);

抛出异常:

Exception in thread "main" java.lang.NoSuchFieldError: ignoreMethodBodies
at org.eclipse.jdt.core.dom.CompilationUnitResolver.parse(CompilationUnitResolver.java:491)
at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1194)
at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:801)
at itjava.model.CompilationUnitStoreIndustry.createCompilationUnitFacadeList(CompilationUnitStoreIndustry.java:71)
at itjava.presenter.WordInfoPresenterIndustry.SetCompilationUnitListAndAccessRepository(WordInfoPresenterIndustry.java:162)
at itjava.industry.code2String.main(code2String.java:31)
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]

解析的源代码是一个简单的java文件,用于使用JDBC连接数据库。

最佳答案

我面临着几乎 similar problem并找到了解决办法。无论您在什么环境中运行代码,它的类路径中都有一些与 jdt 核心不兼容的组件。

关于java - 'java.lang.NoSuchFieldError : ignoreMethodBodies' Exception while creating AST,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9961588/

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