JavaFX Custom File Extension Viewer boilerplate
This is a boilerplate for creating a JavaFX application that is capable of handling a custom file extension. There are some nuances/caveats to getting this right (especially on MacOS), which are described in the accompanying blog post. In this example, the application is set up to handle
.pew files with the bundle identifier
com.example.pew. The Makefile will generate a MacOS
.app bundle by executing the following steps:
- Build the JavaFX application using jlink
- Generate a boilerplate
- Copy over the Java image from the build folder to the app bundle
- Replace the generated
Info.plistfile with a custom one from the
- Compile the sketch file to an icon set
AppIcon.iconsetand replace the default droplet icon with it
- OpenJFX 13
- OpenJDK 13
# run: make -B # bundle mac app: make -B plist icons bundle
- The java application itself will not carry the application name specified in the MacOS top menu bar, but will be named
java. This should be solveable by providing the name as an option (
-Xdock:name="Example App") to the shell launcher, however that option has always been ignored for me.
- Since the applescript launcher needs to "stay open", in order to receive further file opening events after launch, the launcher will remain in the Mac dock.
- This is not a standard file structure, App Store would just reject this without further adjustments.