2012-04-01 12 views
0

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を使用してデータベースに接続します。

+0

この前の質問を参照してください。それは助けるかもしれません。 [http://stackoverflow.com/questions/2225737/error-jdwp-unable-to-get-jni-1-2-environment][1] [1]:HTTP: //stackoverflow.com/questions/2225737/error-jdwp-unable-to-get-jni-1-2-environment –

+0

qn。投稿されたuはこれとはまったく異なります..間違ったリンクかもしれません。 – iRiddler

答えて

1

私はほぼsimilar problemに直面していましたが、修正が見つかりました。どのような環境で実行していても、クラスパスにはjdtコアと互換性のないコンポーネントがいくつかあります。

+0

ありがとうございました。私はApache/libからecj.jarを削除しました。 – iRiddler

関連する問題