Reputation: 2013
I have been a .net developer for some time now and recently started using java and eclipse.
Up until now i've been executing a little test app by right-clicking in Eclipse and "Run As-> Java Application".
Everything works fine until i go to try set this up so i can deploy it to another machine.
In .Net, it's easy. All the references will be automatically included in the output folders, so all one has to do is take the entire package and move it to another machine and run from there.
Does this happen for java?
I've been playing around with javac.exe and it's needing quite a bit of information to get this to build. I'm really just trying to find the equivalent of building the project in debug mode so i can avoid setting up ant configurations.
Thanks for the ideas
Upvotes: 3
Views: 103
Reputation: 892
To expand Bogdan's answer, when the Runnable Jar File Export wizard comes up, choose a Launch Configuration and an Export destination, and select "Copy required libraries into subfolder...." then click finish.
Then from the directory the jar was exported to you should be able to run:
java -jar yourProject.jar
And you should be able to copy that jar and the subfolder with the required libraries to any computer and run it there also.
Upvotes: 0
Reputation: 14705
"Does this happen for java?" " - Yes you need to build the project file, then export it as a "Runnable jar".
You will find your .jar file in a directory specified by your export command. GUIs nowadays associate .jar files with the command java -jar +Jar file. which executes the .jar file.
Why debug mode?
Upvotes: 3
Reputation: 5406
In Eclipse, right click the project, go to export, and select "Runnable jar file". You also have several options for libraries handling.
Upvotes: 1