Java xtext:除了Eclipse编辑器外,如何使用语法?

Java xtext:除了Eclipse编辑器外,如何使用语法?,java,eclipse,xtext,Java,Eclipse,Xtext,我试图将示例org.eclipse.xtext.example.arithmetics.arithmetics与xtext一起使用。我可以按照和中所述运行Eclipse应用程序,因此编辑器将执行语法检查 但是我如何在Java应用程序中实际使用该模型呢?我不是说代码生成 我找到了这个。但是我需要在构建路径中包含哪些.jar文件呢?这里有很多未解析的类 new org.eclipse.emf.mwe.utils.StandaloneSetup().setPlatformUri("../"); Inj

我试图将示例org.eclipse.xtext.example.arithmetics.arithmetics与xtext一起使用。我可以按照和中所述运行Eclipse应用程序,因此编辑器将执行语法检查

但是我如何在Java应用程序中实际使用该模型呢?我不是说代码生成

我找到了这个。但是我需要在构建路径中包含哪些.jar文件呢?这里有很多未解析的类

new org.eclipse.emf.mwe.utils.StandaloneSetup().setPlatformUri("../");
Injector injector = new MyDslStandaloneSetup().createInjectorAndDoEMFRegistration();
XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class);
resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
Resource resource = resourceSet.getResource(
    URI.createURI("platform:/resource/org.xtext.example.mydsl/src/example.mydsl"), true);
Model model = (Model) resource.getContents().get(0);

如果您不想自己查找所有依赖项Jar,您可以使用右键单击Project->Export->Java->Runnable Jar文件来帮助收集所有依赖项Jar

如果您不想自己查找所有依赖项Jar,您可以使用右键单击Project->Export->Java->Runnable Jar文件来帮助收集所有依赖项JarJAR

这些是我找到的依赖项:

<classpathentry kind="lib" path="D:/gabor/eclipse2/plugins/org.eclipse.emf.mwe.utils_1.2.1.v201112070431.jar"/>
<classpathentry kind="lib"  path="D:/gabor/eclipse2/plugins/org.eclipse.xtext_2.2.1.v201112130541.jar"/>
<classpathentry kind="lib" path="D:/gabor/eclipse2/plugins/org.eclipse.emf.ecore_2.7.0.v20120127-1122.jar"/>
<classpathentry kind="lib" path="D:/gabor/eclipse2/plugins/org.eclipse.emf.common_2.7.0.v20120127-1122.jar"/>
当然还有dsl项目和生成的源代码。
这不是一个好的解决方案,我按下ctrl-shift-t,搜索缺少的类,列表显示eclipse在哪些jar中找到该类,然后我将该jar作为外部jar添加到我的类路径中。

我找到了这些依赖项:

<classpathentry kind="lib" path="D:/gabor/eclipse2/plugins/org.eclipse.emf.mwe.utils_1.2.1.v201112070431.jar"/>
<classpathentry kind="lib"  path="D:/gabor/eclipse2/plugins/org.eclipse.xtext_2.2.1.v201112130541.jar"/>
<classpathentry kind="lib" path="D:/gabor/eclipse2/plugins/org.eclipse.emf.ecore_2.7.0.v20120127-1122.jar"/>
<classpathentry kind="lib" path="D:/gabor/eclipse2/plugins/org.eclipse.emf.common_2.7.0.v20120127-1122.jar"/>
当然还有dsl项目和生成的源代码。
这不是一个好的解决方案,我按下ctrl-shift-t,搜索丢失的类,列表显示eclipse在哪些jar中找到该类,然后我将该jar作为外部jar添加到我的类路径中。

我不是指MyDslStandaloneSetup,我已经将其更改为我自己的类可能的副本,我不是指MyDslStandaloneSetup,我已经把它改成了我自己的班级