开发者

ASTparser for javascript exception NoClassDefFoundError: RegistryFactory

I'm trying to use ASTparser to parse javascript. When I run the code:

ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(source.toString().toCharArray());

parser.setKind(ASTParser.K_COMPILATION_UNIT);

I get this error:

Exception in thread "main" java.lang.NoClassDefFoundError:       org/eclipse/core/runtime/RegistryFactory
    at org.eclipse.core.internal.runtime.InternalPlatform.getRegistry(InternalPlatform.java:556)
    at org.eclipse.core.runtime.Pla开发者_Go百科tform.getExtensionRegistry(Platform.java:919)
    at org.eclipse.wst.jsdt.core.infer.InferrenceManager.loadInferenceExtensions(InferrenceManager.java:155)
    at org.eclipse.wst.jsdt.core.infer.InferrenceManager.getInferenceProviders(InferrenceManager.java:63)
    at org.eclipse.wst.jsdt.core.infer.InferrenceManager.getInferenceEngines(InferrenceManager.java:103)
    at org.eclipse.wst.jsdt.internal.compiler.parser.Parser.initializeInferenceEngine(Parser.java:6048)
    at org.eclipse.wst.jsdt.internal.compiler.parser.Parser.parse(Parser.java:6014)
    at org.eclipse.wst.jsdt.internal.compiler.parser.Parser.parse(Parser.java:5988)
    at org.eclipse.wst.jsdt.internal.compiler.parser.Parser.dietParse(Parser.java:4593)
    at org.eclipse.wst.jsdt.core.dom.JavaScriptUnitResolver.parse(JavaScriptUnitResolver.java:406)
    at org.eclipse.wst.jsdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:880)
    at org.eclipse.wst.jsdt.core.dom.ASTParser.createAST(ASTParser.java:647)

I added org.eclipse.core.runtime to the project but it didn't fix the error.


I fixed the problem: just add org.eclipse.equinox.registry jar file to the project.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜