0

first time posting here, java beginner.

I made a basic calculator that receives user input. Is there a way to export my program to make a runnable desktop file?

My IDE is IntelliJ.

Thanks in advance!!

  • 1
    https://docs.oracle.com/javase/tutorial/deployment/jar/build.html – UnholySheep Mar 07 '17 at 15:30
  • 1
    You could make an executable jar or use something like launch4j to make an exe. I recommand the first option, but it requires an installed JRE on the target environment. – Aaron Mar 07 '17 at 15:30
  • Possible duplicate of [How can I convert my Java program to an .exe file?](http://stackoverflow.com/questions/147181/how-can-i-convert-my-java-program-to-an-exe-file) – MaxZoom Mar 07 '17 at 15:51

1 Answers1

1

Assuming you are building a JavaFX app: The easiest way to deploy your app is to go to File>Project Structure>Artifacts.

Add your available elements (if you have any extra images etc) into your output root, and click on your jar file. At the bottom of the window you'll see options to either create a manifest file or modify an existing one. The manifest file describes the first class to load in your program (the starting point) as well as the locations of any third party libraries you may have included in your program.

You will also have a JavaFX tab that you can use to set some initial parameters for your app, such as the title, version, and whether you want to deploy any native bundles (eg: .exe for Windows, .deb for Ubuntu etc)

Once you have configured the important parameters you want, save your settings (or just select any field and click enter) and go to Build>Build Artifacts>Action: Build IntelliJ should generate an executable .jar file and any native bundles you selected. The native bundles can just be double clicked, and the jar file can be run using a JRE.

On blog.jetbrains.com they show the steps with some screenshots.

Note that this entire process is called deploying your app and there are a variety of tools and methods to do it. I just described what I believe is the simplest way.

martijnn2008
  • 3,552
  • 5
  • 30
  • 40
  • 1
    This doesn't require the project to use JavaFX - you can build any kind of Java module into a JAR file (see the [IntelliJ doc](https://www.jetbrains.com/help/idea/2016.3/packaging-a-module-into-a-jar-file.html)) – UnholySheep Mar 07 '17 at 15:58