'java.lang.NoSuchFieldError:ignoreMethodBodies'创建AST时出现异常
问题描述:
将java源代码传递给下面提到的代码时,我收到一个异常,并不知道如何解决此问题。 Kindlly让我知道我错了/任何替代解决方案...'java.lang.NoSuchFieldError:ignoreMethodBodies'创建AST时出现异常
源代码:
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核心不兼容的组件。
+0
谢谢了..我从我的Apache/lib中删除了ecj.jar,现在它工作正常。 – iRiddler 2012-04-05 19:35:25
请参考前面的问题。它可能有帮助。 [http://stackoverflow.com/questions/2225737/error-jdwp-unable-to-get-jni-1-2-environment][1] [1]:HTTP: //sackoveroverflow.com/questions/2225737/error-jdwp-unable-to-get-jni-1-2-environment – 2012-04-02 06:46:51
qn。你贴的是完全不同的这个..错误的联系也许。 – iRiddler 2012-04-05 23:18:36