The GUI is already built and it runs if I compile. how to create the executable to run on any machine?
The GUI is already built and it runs if I compile. how to create the executable to run on any machine?
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.
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