Package your desktop application
If you would like to deploy your DukeScript application for desktop, you can simply use maven:
>mvn -Pdesktop clean package
This works when the application has been created from the archetype. The pom.xml of your main project will then contain a profile like this:
The Maven assembly plugin is used to package everything. If you run the Maven command described above a ZIP-Archive will be created that you can deploy to your users. The application can then be started by a double-click on the main jar-file.
In the Plugin configuration section there’s a reference to the descriptor “javafx.xml”. You can modify this descriptor, if you want to add extra resources.
For example I recently needed to add a start script for Windows, because I wanted to pass the default encoding to the application. On Windows this is often CP1250 or CP1252, which can cause problems if users work on the same data files on different platforms. It’s easy to set the default encoding as a system property, but it has to happenbefore the application starts.
So the content my Batch File looks like this:
In the javafx.xml descriptor file find the filesets section. This is used to copy the HTML-Files, CSS, etc into the archive. It looks like this:
Now copy this section and adjust it to your needs. My Batch-File is in the src/main/bin directory:
That’s it. If you package the application the next time this File will also be copied.
By the way: If you’re using NetBeans there’s a convenient predefined action in the context menu of your project: “Run Maven” -> “Build Desktop app” which starts the Maven command described above.