gpt4 book ai didi

java - ASTParser 依赖项

转载 作者:行者123 更新时间:2023-12-04 06:30:56 25 4
gpt4 key购买 nike

我正在尝试在 this 的帮助下学习 ASTParser教程。当我编译第一段代码时:
ASTParser parser = ASTParser.newParser(AST.JLS2);
parser.setSource("".toCharArray());
CompilationUnit unit = (CompilationUnit) parser.createAST(null);
unit.recordModifications();
AST ast = unit.getAST();

我收到此错误:

Source non found. The JAR of this class file belongs to container 'Plug-in Dependencies' which does not allow modifications to source attachments on its entries.



我能做什么?

最佳答案

根据 this ,你应该包括这些 jar 文件:

  • org.eclipse.core.contenttype.jar
  • org.eclipse.core.jobs.jar
  • org.eclipse.core.resources.jar
  • org.eclipse.core.runtime.jar
  • org.eclipse.equinox.common.jar
  • org.eclipse.equinox.preferences.jar
  • org.eclipse.jdt.core.jar
  • org.eclipse.osgi.jar
  • 关于java - ASTParser 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5433860/

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