tags:

views:

84

answers:

4

I have a java application that I created. Now I want to give it to my friend? How do I create a deploy version of this that they can run?

A: 

Create a JAR file (it's in the export menu), and send that to them. JAR files contain all the classes in a Java application, and a manifest that specifies things like which one is the main class. If the application depends on other 3rdparty libraries, you'll need to include them as well; it's possible to bundle them in the JAR file, but it's non-trivial

Michael Mrozek
A: 

I think this is what you are looking for. Basically make it into a self-executing jar and run. It gets more complicated if you have other dependencies besides the standard API in Java.

Yishai
+1  A: 

The easiest for you is to export the program as a "Runnable JAR file". Your friend then does this from the command line:

java -jar MyApp.jar

Probably the easiest way for your friend is if you take the above jar file and deploy it with WebStart. It's cross platform. Your friend simply uses their web browser to browse to the web page where the application is hosted and clicks on a link.

Marcus Adams
A: 

Create a jar file, and put the following info in your manifest file

Manifest-Version: 1.0
Class-Path: lib.jar 
Main-Class: mypackage.MyClassWithMainMethod
qichuan