Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Deploying xtext parser to standalone jar
Deploying xtext parser to standalone jar [message #1066821] Thu, 04 July 2013 10:09 Go to next message
Eclipse UserFriend
Hi guys,

I have developed a grammar for my language using Xtext. Next, I have tried to export the grammar project as runnable jar file so that specifications written in my language can be parsed through this jar file.

To do this, I firstly created a java application via run configurations part of the eclipse. There I set the main class as "org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher".
Then, I tried to export the project as runnable jar file where I specified the java application I have just created as the "launch configuration".
However, whwn use the command to run the exported jar file "java -jar mylang.jar model.mylang" I always get the below error:
"Failed to load Main-Class manifest attribute from myylang.jar".

Can anyone help me on this please ? How can I resolve this issue so that I can deploy my xtext project as runnable jar file through which parsing can be performed ?

thanks a lot
Re: Deploying xtext parser to standalone jar [message #1066824 is a reply to message #1066821] Thu, 04 July 2013 10:12 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

you should create a java main class yourself (or let the generatorfragment create it)
the run it once. the use the export wizard using this main.
Re: Deploying xtext parser to standalone jar [message #1066836 is a reply to message #1066824] Thu, 04 July 2013 12:03 Go to previous messageGo to next message
Eclipse UserFriend
THanks a lot for the reply.
However, I have no idea about the codes that are to be located in the Main.java; so, the parser can work properly.
Can you provide me with such a code snippet ?
Re: Deploying xtext parser to standalone jar [message #1066837 is a reply to message #1066836] Thu, 04 July 2013 12:14 Go to previous messageGo to next message
Eclipse UserFriend
hi,

i asked you to change the languageworkflow to

fragment = generator.GeneratorFragment auto-inject
{
generateJavaMain = true
}
Re: Deploying xtext parser to standalone jar [message #1066839 is a reply to message #1066837] Thu, 04 July 2013 12:25 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Thanks again, however, I do not have any idea what you mean by languageworkflow. Where is that file located ?
Re: Deploying xtext parser to standalone jar [message #1066840 is a reply to message #1066839] Thu, 04 July 2013 12:31 Go to previous messageGo to next message
Eclipse UserFriend
I mean the workflow right next to the .xtext file
Re: Deploying xtext parser to standalone jar [message #1066856 is a reply to message #1066840] Thu, 04 July 2013 15:13 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I have copied pasted the code you had given within the .mwe2 file (where I embed the code in component=Generator block).
Then, I have created a new configuration launch, i.e., a java application whose main class path is specified as "org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher". When, I export using this configuration and subsequently run the command "java -jar mylang.jar", I got the same error : no main manifest attribute, in mylang.jar.

Re: Deploying xtext parser to standalone jar [message #1066858 is a reply to message #1066856] Thu, 04 July 2013 15:16 Go to previous messageGo to next message
Eclipse UserFriend
I Said you should Take the Main class generated and Not mwe launcher
Re: Deploying xtext parser to standalone jar [message #1066859 is a reply to message #1066858] Thu, 04 July 2013 15:41 Go to previous messageGo to next message
Eclipse UserFriend
I am afraid that I am a bit lost.

What should I type into the main class textbox of the configuration launch ?
I did not create a main class except having added the above shown code snippet within the mwe2.

Can you please guide me on getting into the right track here ?
Re: Deploying xtext parser to standalone jar [message #1066860 is a reply to message #1066859] Thu, 04 July 2013 15:49 Go to previous messageGo to next message
Eclipse UserFriend
One more i cannot follow you

(1) create new xtext project
(2) change workflow
(3) run workflow
(4) run the generated "org.xtext.example.mydsl.generator.Main" as Java Application
(5) right klick on project -> export -> java -> runnable jar file
(6) select "Main - org.xtext.example.mydsl.generator" from the Drop Down box + choose location
(7) finish
Re: Deploying xtext parser to standalone jar [message #1066875 is a reply to message #1066860] Thu, 04 July 2013 17:13 Go to previous message
Eclipse UserFriend
Hi Christian,

Yes, I eventually sorted out everything and managed to obtain a standalone runnable jar file through which one can parse their specification in my language.

Thanks a lot for your all support herein.
Previous Topic:Cannot remove org.eclipse.xtext.common.Terminals from gramma
Next Topic:Xbase dependency on JDT
Goto Forum:
  


Current Time: Sun Jul 06 12:19:50 EDT 2025

Powered by FUDForum. Page generated in 0.45487 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top