This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Could anyone help me to transform an Eclipse run configuration into a Java command-line?
I have a project in Eclipse involving jars and DLLs that runs fine and has done for months, but I now want to run it from the command line and I can't find how to translate all the run configurations into command line parameters properly
Instead of exporting to a "runnable jar" try exporting to a regular jar. The last page of the export wizard will give you an option to specify the class with the "main()" function. If you specify this, it will work both as a file that you can click on (in windows) or run from the command line via:
java -jar yourfilename.jar
It should give you any needed error messages, for example, if it can't locate a class because it was not included in the export.
Also, the export to jar wizard is not the easiest--lot's of gotchas in it, imho. On the page where you select the classes to export, make sure that you expand out all of the tree, and click on each package to ensure that all the classes you want to export are marked for export. It's really easy to mistakenly just export a single class or package from a larger project.
You can also copy the jar into a name with a .zip extension and examine the contents that way to see if all the libraries are there or not.
If this doesn't help, also consider the Eclipse 'newbies' forum. They've been tremendous in helping me in the past.
Joined: Dec 13, 2010
The other day, blind and deaf, I just tried a few things and got it to work.. I do not know how
I asked Eclipse to make me a runnable jar, and I dumped all the DLLs and JARs into the same dir as the jar, and the /sounds and /images dirs as well, and it ran
So I can now deliver =)
Joined: Sep 01, 2010
If it works, it works! That's great.
The next level will be when you figure out how to get ALL the resources to fit into a single, clickable jar. Not a trivial task, but not insurmountable either. I've done this with image and sound files but never had a call to also pack dlls.
Joined: Dec 13, 2010
indeed yes, but I am at the point now where I can share with my friends
If the NSI installer won't work with this setup THEN comes the next step