4

Is it possible to create a stand alone application in Java (using Swing) and package it into an exe file?

My Idea is, we should be able to double click it and run the application.

1

5 Answers 5

6

If you export a runnable .jar file you will be able to double click and run, but you'll still need the JVM in order to interpret the bytecode.

Sign up to request clarification or add additional context in comments.

Comments

3

The best way to deploy a Swing based app. to a client's desktop is using Java Web Start.

JWS offers desktop integration - making a desktop shortcut and menu item, each using an icon if specified. The end use can double-click the desktop shortcut cut to launch the app. ( or single-click the menu item to do the same ;).

Best of all, JWS works for all platforms for which the J2SE is supplied. Windows, Ubuntu, Fedora, Solaris, Mac. OS..


For ensuring the user has the correct minimum JRE needed to run the app., use deployJava.js to write the link to the JNLP launch file.

Comments

3

If you export your project in a .jar file, you will be able to run it when you click on it.

I suppose that you know that you must have the virtual machine installed in the computer that runs the program.(The virtual machine is the thing that allows java to be operative system independent)

And also you must know that if you transform that .jar to an .exe file using some kind of gadget... Then java will not be java anymore, because will not be able to run it in non-windows operative systems.

Remember java slogan

'Write once run everywhere"

See this image here i will explain you how to create a .jar using the eclipse IDE:

enter image description here

1-Select your project in the package explorer

2-Select File>Export from the menu

3-Pick Runnable JAR file from the dialog and

4-Click next and follow the rest of the wizard

Comments

1

You can package your application to JAR file. Application in jar file runs on duoble click. Here is tutorial. http://download.oracle.com/javase/tutorial/deployment/jar/

Comments

0

You can already do this with a normal .jar file if the user has configured the extension to be executed with the JRE. But you can always use something like Launch4J. Please Note this simply wraps the Jar in a EXE file. The file still needs your Dependencies (.jars) and the JRE enviroment.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.