【问题标题】:"Aborting: no path to EMF resource provided!"“中止:没有提供 EMF 资源的路径!”
【发布时间】:2018-06-06 21:22:13
【问题描述】:

我想从 jar 文件中运行一个名为 Hoare Advanced Homework Assistant 的程序验证工具。 首先,我从 Web 站点 ("http://haha.mimuw.edu.pl/") 下载源文件并将它们导入 Eclipse。 然后我按照 BUILD.txt 进行安排并创建了一个可执行 Jar 文件。 但是我在命令提示符下执行 jar 文件,出现以下消息。
“中止:未提供 EMF 资源的路径!”
我认为需要一个论点,但我不知道应该给出什么论点。 这是一个主类程序:

public class Main{
    public static void main(String[] args) {
        if (args.length==0) {
            System.err.println("Aborting: no path to EMF resource provided!");
            return;
        }

        Injector injector = new net.afyre.haha.demo.HahaStandaloneSetupGenerated().createInjectorAndDoEMFRegistration();
        Main main = injector.getInstance(Main.class);
        main.runGenerator(args[0]);
    }

    @Inject 
    private Provider<ResourceSet> resourceSetProvider;

    @Inject
    private IResourceValidator validator;

    @Inject(optional=true)
    private IGenerator generator;

    @Inject 
    private JavaIoFileSystemAccess fileAccess;

    protected void runGenerator(String string) {
        // load the resource
        ResourceSet set = resourceSetProvider.get();
        Resource resource = set.getResource(URI.createURI(string), true);

        // validate the resource
        List<Issue> list = validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl);

        if (!list.isEmpty()) {
            for (Issue issue : list) {
                System.err.println(issue);
            }
            return;
        }

        // configure and start the generator

        fileAccess.setOutputPath("src-gen/");
        if (generator != null) {
            generator.doGenerate(resource, fileAccess);
        } else {
            System.out.println("Code generator not foubnd!");
        }
        System.out.println("Code generation finished.");
    }
}

能否请您为我提供解决方案?谢谢。

【问题讨论】:

  • 嗨,我确定 Stackoverflow 是这个问题的错误地方,请询问该软件的作者。索引页底部有联系邮箱haha.mimuw.edu.pl

标签: java emf


【解决方案1】:

预期的字符串可能是“platform:/resource/my.project/my.folder/my.file”的形式,或者用“plugin”切换“resource”。基本上任何符合URI.createURI 的代码都可以。

【讨论】:

    猜你喜欢
    • 2017-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多