2

Well I have made a few games and programs in java, and I was wondering, HOW DO YOU MAKE THIS EXE? I have been looking around google for the answer and I couldn't find any program or website that helped. So I want to make it EXE myself, manually. I have already tried JSmooth, and that didn't work.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
Noah Cagle
  • 146
  • 1
  • 4
  • 15

2 Answers2

1

You need to learn about creating an executable jar. Once you create that, you can simply run it by double clicking on that. Here is a tutorial to help you with that:

http://www.mkyong.com/java/how-to-make-an-executable-jar-file/

If you want to create a batch/cmd/sh script then you can put your java command in that script to invoke your main class.

A sample batch script taken from a related post(How to run java application by .bat file):

@ECHO OFF
set CLASSPATH=.
set CLASSPATH=%CLASSPATH%;path/to/needed/jars/my.jar

%JAVA_HOME%\bin\java ro.my.class.MyClass

On the same lines, you can write a shell script on linux/unix.

Community
  • 1
  • 1
Juned Ahsan
  • 67,789
  • 12
  • 98
  • 136
1

Java now ships with a tool that can convert your application into an executable. The documentation is written for JavaFX applications. I think you should be able to use it for any java application though.

Check out this article discussing how to deploy a JavaFX Application: http://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm

Using this tool requires that you install Inno5 Setup (for creating an exe) or WiX (for creating an msi) or both if you want to create and deploy both an exe and an msi.

If this tool that ships with Java doesn't work for you there are projects such as install4j that convert your project to an exe. See http://www.ej-technologies.com/products/install4j/overview.html.

axiopisty
  • 4,972
  • 8
  • 44
  • 73