Hi all,

If I write a java program inside of eclipse, how can I run that program outside of it, rather than just hitting the run button in eclipse. So, I can give others the program to run on their computers. Thanks!

Recommended Answers

All 7 Replies

Right click project - export - runnable jar file

you mean as an .exe file or .jar file. if that is what you are talking about there is a way to do that or if not you can compile your program to .class that way someone can run it on their computer too.

For example I write a simple calculator program in eclipse on my laptop. Then I want to be able to run the calculator program on my desktop(without having the code in a compiler).

What is the difference between a .jar and .class?

a .class file is a compiled .java file
if you want to run this, you'll have to open the command prompt and go
<path> java classname

if on the other hand you have a java file, which is an archive executable file, you can run it by just clicking on it.

Awesome, thanks for all the information guys!

different between .jar and .class is that .jar is a Jar file containing many classes. In your case i will suggest you to convert it to jar file that way you can run it on your destop. if you are using netbeans its pretty easy just click on the build and run you will have your jar file in your dist folder. but if you are using eclipse you can read this docs http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftasks-33.htm

Great thanks for the help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.