Using jpackage I can't get a pkg to run on macOS. The installation goes as expected however when I launch the installed application it starts then immediately stops.
Attempting to launch it via CLI and it throws
Error: Could not find or load main class com.example.Application
Caused by: java.lang.ClassNotFoundException: com.example.Application
I've passed the MainClass argument as com.example.Application, and I can see it in the installed bundle under Contents/app/example.jar.
Using the Gradle plugin id "org.panteleyev.jpackageplugin" version "1.3.1" to build the native installer:
def os = org.gradle.internal.os.OperatingSystem.current()
def pkgType = os.windows ? 'msi' : os.linux ? 'deb' : 'pkg'
def inputDir = "$buildDir/input"
task copyDependencies (type: Copy) {
from configurations.runtimeClasspath
into inputDir
}
task copyJar (type: Copy) {
from tasks.jar
into inputDir
}
jpackage {
dependsOn clean
dependsOn bootJar
dependsOn copyDependencies
dependsOn copyJar
type = pkgType
input = inputDir
destination = "$buildDir/dist"
appName = 'Example'
vendor = 'com.example'
mainJar = tasks.jar.getArchiveFileName().get()
mainClass = 'com.example.Application'
javaOptions = ['-Dfile.encoding=UTF-8']
}
The jar runs just fine when launched via IntelliJ/via CLI.
What else do I need to do here?