How to make the program executable?

-2

The GUI is already built and it runs if I compile. how to create the executable to run on any machine?

    
asked by anonymous 26.05.2015 / 21:26

2 answers

0

Depends on the IDE you are using. At the command line it would look something like this:

java NomeDoPrograma

Note that the program name does not end with .class If the program has several packages then it will have to do so:

java caminho/para/o/pacote/com/a/classe/principal/NomeDoPrograma

If you are in NetBeans just click on the button that has a hammer and a broom on top, and this will create a .jar file that can be found in the path of your program where it is stored. the .jar should be +/- this way

/NetBeansProjects/NomeDoProjeto/dist 

or jar should be found.

    
26.05.2015 / 21:30
1

In order to distribute / execute a Java program, basically you must generate .jar (which depends on how you did the project, if you used Maven for example would execute the package phase) and also if you are using some IDE. With .jar ready, you must create batch files to run in each environment. In windows it will be a .bat and in linux and mac. In these files you can (if necessary) set properties like JAVA_HOME, JAVA_OPTS, classpath, etc. In one of the projects I work there are examples: link

    
29.05.2015 / 19:31