How to generate an executable from a program made in Eclipse?

2

I made a program for the company where I work entirely on JOptionPane , just so that the program would only work by opening real system windows (I thought it would be easier to run officially after export than one I saw running through the Eclipse text box).

My code is 100% ready and functional, and Eclipse is not reporting any errors. But obviously, no other employee of the company has Eclipse to be opening the program for him. I need the program to be opened by any computer, Windows or Mac. For this, I would need a version of the program in .exe (for Win) and .dmg (Mac).

Question 1: How do I create these executables? My operating system is Mac and Eclipse is Neon3.

Question 2: What are the requirements for future users of my software to run it? Only Java installed? Windows / Mac already come with the necessary programs?

    
asked by anonymous 19.05.2017 / 02:10

1 answer

2
  

Question 1: How do I create these executables? My operating system is Mac and Eclipse is Neon3.

You can export a jar of your program in eclipse by going to File > Export... , selecting the Runnable JAR file option from the list.

On the next screen, you select in the list your class Main of the project and a name for the jar. It is important that the project has already been executed in eclipse, otherwise it will not appear in this list, since eclipse creates some settings for each executed class that has a main method, and uses these to also create the jar.

In the example below, I'm creating a jar of my Test Project , and ClasseMain as the class starts the application:

Afterthis,theapplicationwillrunfromthejar,through2clicks.Ifyouwant,youcanuse Launch4j , which bundles the jar into an exe , and lets you set various parameters as the maximum and minimum version of the JRE that the user must have to execute his application, decorate with an icon, etc ...

  

Question 2: What are the requirements for future users of my software to run it? Only Java installed? Windows / Mac already come with the necessary programs?

If you include all third-party libs in the project classpath, you no longer need anything from the user unless you have the Java virtual machine (JRE) installed. Of course, it must use a version equal to or greater than the one you used to compile your application.

    
19.05.2017 / 02:42