Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Deploying xtext parser to standalone jar
Deploying xtext parser to standalone jar [message #1066821] Thu, 04 July 2013 14:09 Go to next message
mcse mcse is currently offline mcse mcseFriend
Messages: 53
Registered: August 2012
Member
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 14:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
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.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Deploying xtext parser to standalone jar [message #1066836 is a reply to message #1066824] Thu, 04 July 2013 16:03 Go to previous messageGo to next message
mcse mcse is currently offline mcse mcseFriend
Messages: 53
Registered: August 2012
Member
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 16:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hi,

i asked you to change the languageworkflow to

fragment = generator.GeneratorFragment auto-inject
{
generateJavaMain = true
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Deploying xtext parser to standalone jar [message #1066839 is a reply to message #1066837] Thu, 04 July 2013 16:25 Go to previous messageGo to next message
mcse mcse is currently offline mcse mcseFriend
Messages: 53
Registered: August 2012
Member
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 16:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
I mean the workflow right next to the .xtext file

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Deploying xtext parser to standalone jar [message #1066856 is a reply to message #1066840] Thu, 04 July 2013 19:13 Go to previous messageGo to next message
mcse mcse is currently offline mcse mcseFriend
Messages: 53
Registered: August 2012
Member
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 19:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
I Said you should Take the Main class generated and Not mwe launcher

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Deploying xtext parser to standalone jar [message #1066859 is a reply to message #1066858] Thu, 04 July 2013 19:41 Go to previous messageGo to next message
mcse mcse is currently offline mcse mcseFriend
Messages: 53
Registered: August 2012
Member
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 19:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
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


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Deploying xtext parser to standalone jar [message #1066875 is a reply to message #1066860] Thu, 04 July 2013 21:13 Go to previous message
mcse mcse is currently offline mcse mcseFriend
Messages: 53
Registered: August 2012
Member
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: Fri Apr 26 16:11:14 GMT 2024

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

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

Back to the top