0

The .cfg file created by JPackage contains some useful metadata such as the app.version. Here's a snippet...

app.name=MyApp
app.version=1.0
app.runtime=$APPDIR\runtime
app.identifier=com.company.package
app.classpath=
app.mainmodule=application/com.company.package.Main

[JavaOptions]

[ArgOptions]

Is there a simple way to query this file through Java without manually loading the file from the file system and parsing it?

For context, we would have liked to retrieve the version from the manifest within the JAR, but unfortunately this doesn't seem to be available when the application is built using modules.

Cheers.

1 Answers1

0

Some of those fields can be read from the system properties inside the app - assuming you use jpackage --app-version flag:

System.getProperty("jpackage.app-path");
System.getProperty("jpackage.app-version");
System.getProperty("java.home");
System.getProperty("java.class.path");

If there are other fields that are important to you it is also possible to specify other settings to apply to launchers using --java-options "-Dyour.field=XYZ"

DuncG
  • 12,137
  • 2
  • 21
  • 33