-2

I have created a project in java Netbeans and I want to create an .exe or .jar file that can be run on any other systems. my project have a Main.java class and an other class GetRules.java . the .exe file should be such that it can be run in any folder that contain train.txt as input and create Model.txt as output

how can I do this?

Rezan
  • 351
  • 1
  • 4
  • 5
  • 2
    For deploying Java desktop apps., the best option is usually to install the app. using [Java Web Start](http://stackoverflow.com/tags/java-web-start/info). JWS works on Windows, OS X & *nix. – Andrew Thompson Jun 07 '13 at 06:35

2 Answers2

0

what you are looking for is an executable file which can execute you project calling you main class

so here is what you can do

step 1 : collect all the files , class files

step 2 : create a jar file collecting all the files from your project

step 3 : this.jar file is executable on any environment with a JVM available

you will have .jar file , rather than .exe file , but serves you the purpose

you can refer this link to learn how to create jar files

0

Java programs are not compiled into exe files but Java byte code which is usually stored in jar containers. exe files run on Windows systems only, but Java byte code is platform independent.

What you could do is use a wrapper like Launch4j. It wraps the jar file into an exe file.

Sky
  • 674
  • 8
  • 22