I'm just wondering, I just wrote this program on eclipse for myself and my math friends and I would love to send it to them, but in all honesty I have no idea how to, is it possible to write a program in eclipse but have it be able to run outside of eclipse and also to be able to send it to people? Any help would be so appreciated, and if someone knows the remedy to my question, a step by step for the noob that I sadly am would be just so so so so so soo sooooo appreciated, thanks again for anyone who can help!
-
[**This**](http://stackoverflow.com/a/2011746/2817802) and [**this**](http://stackoverflow.com/a/147233/2817802) answers your question – Baby Feb 14 '14 at 01:43
-
@RafaEl: no, those links are unnecessary and misleading. He does not need to create an exe, and certainly shouldn't if he wants to run his code on most platforms other than windows. – Hovercraft Full Of Eels Feb 14 '14 at 02:38
4 Answers
is it possible to write a program in eclipse but have it be able to run outside of eclipse and also to be able to send it to people?
Yes it is, export your program as a Java Archive (JAR)
, an executable or runnable JAR to be more specific as the person you are sending to can directly execute it.
Here is a way to do it.
How to execute?
java -jar math.jar
All you need on the machine where you are executing the jar file is Java Runtime (JRE)

- 41,187
- 18
- 82
- 120
Eclipse has an export submenu in its file menu that you should explore, and use it to create a jar file. Here is a link to the tutorial on using this: Creating a New Runnable JAR File

- 283,665
- 25
- 256
- 373
The best way to send programs to people is to click on File -> Export -> Runnable Jar file. This will compile the program into a compressed format that can be run just like any other application.

- 1,048
- 8
- 17
You can create a runnable jar
see http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftasks-37.htm
basically
From the menu bar's File menu, select Export. Expand the Java node and select Runnable JAR file. Click Next. In the Opens the Runnable JAR export wizard Runnable JAR File Specification page, select a 'Java Application' launch configuration to use to create a runnable JAR. In the Export destination field, either type or click Browse to select a location for the JAR file. Select an appropriate library handling strategy. Optionally, you can also create an ANT script to quickly regenerate a previously created runnable JAR file.
but remember that a runnable jar is not a real executable. Your friends need a suitable java interpreter in their machines in order to run your code.

- 6,480
- 4
- 37
- 52