1

Why when I'm generating an artifact for a javafx application using Intellij IDEA, besides the .jar, it generates a .html and a .jnlp file?, are those two necessary for the application to work, if not is there a setting I can change in order to don't create those anymore?

Moises Zermeño
  • 763
  • 1
  • 6
  • 18
  • The files required for deployment depend on the [execution mode](https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/deploy_overview.html#BABCGDJF) of your application. What is the execution mode of your application? – jewelsea May 08 '15 at 19:14
  • @jewelsea It is supposed to be "Run as a standalone program" , in the Artifacts section I created a new->"JavaFx Application"->"From module xxxx", should I pick new->"JAR" instead? – Moises Zermeño May 08 '15 at 19:30
  • possible duplicate of [Intellij Javafx artifact - how do you make it?](http://stackoverflow.com/questions/12237269/intellij-javafx-artifact-how-do-you-make-it) –  May 08 '15 at 19:59
  • I disagree that this is a duplicate Jarrod, Moises already knows (and is) making JavaFX artifacts using IntelliJ, he just wants to know what is the use of the files output by the IntelliJ packaging system. – jewelsea May 08 '15 at 20:12

1 Answers1

2

Files Required for Various JavaFX Execution Modes

it generates a .html and a .jnlp file?, are those two necessary for the application to work

The files required for deployment depend on the execution mode of your application.

  1. If your application is embedded in a browser (e.g. executes via the Java plugin like a traditional Java applet), then you require all of the .html, .jnlp and .jar files.
  2. If your application is launched from a browser via Webstart using the Java deployment toolkit, then you require all of the .html, .jnlp and .jar files.
  3. If your application is launched via Webstart from a web page via a direct href link to the jnlp file, then you only need the .jnlp and .jar file.
  4. If your application is distributed as a "standalone program" (e.g. "Users launch it using a Java launcher, such as java -jar MyApp.jar, or by double-clicking the application JAR file."), then you only need the .jar file.
  5. If your application is distributed as a "self-contained" application then you need none of the .jnlp, .html or .jar files, as everything required to run your application will be packaged into a native install package (e.g. .rpm, .msi, .deb, .dmg) that you will distribute.

Suggested Approach

As you will be using the "standalone program" form of distribution, you only require the .jar file for distribution and can ignore other files created by the Java packaging tools.

While you could have Idea package your application as a JAR by choosing Build | Build Artifacts | Edit... | + | JAR | From modules with dependencies..., I don't recommend that as you will also need to set a main class in the manifest and will lose some of the functionality of files which are packaged using Idea's "JavaFX Application" packaging type, such as in-built detection that the Java runtime used to launch the application meets minimum requirements to run JavaFX applications and transparent network proxy support.

So instead, just use, unchanged, the Idea artifact packaging configuration that you have already setup. Ignore the .html files and .jnlp files output. Just distribute the .jar file to your users along with instructions on how to launch it either via java -jar MyApp.jar or double-clicking the .jar after a Java runtime has been installed on their machine.

Portable Build Advice

If it is only you developing the project and you are unfamiliar with external build tools such as maven or gradle, then it is (probably) simpler to use the artifact packaging features built into your Idea IDE rather than to learn and use external tools.

If your project might potentially be worked on by other developers or builds are to be produced and tested within a continuous integration system such as Jenkins, I do not recommend relying on IDE specific build systems such as the artifact packager in Idea. Instead, use an external build tool such as maven or gradle. There is a maven plugin and a gradle plugin for JavaFX build.

jewelsea
  • 150,031
  • 14
  • 366
  • 406