在将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连接数据库。