jnativehook
jnativehook copied to clipboard
When packaging modular projects with jpackage, module names can't start with "app."
When using jpackage to package a modular project, after importing this module, the module name cannot start with app.
Here's a minimal example: https://github.com/beryx-gist/jnativehook-modular-demo
This example works perfectly. However, when you change the application's module name to start with app.
, the packaged result with jpackage fails to run.
build.gradle:
application {
mainModule = "org.jnativehook.demo" // Change to "app.jnativehook.demo"
...
}
jpackage {
imageOptions += ["--win-console"] // To see the error messages
...
}
module-info.java
module org.jnativehook.demo { // Change to "app.jnativehook.demo"
// When using this module, surprisingly the application module name cannot start with 'app.' or 'bpp.', but it can start with 'cpp.' or 'dpp.'?
// Otherwise, an error will occur when running the packaged result with jpackage:
// Error: A JNI error has occurred, please check your installation and try again.
// Exception in thread "main" java.lang.InternalError: Module app.jnativehook.demo not in boot Layer.
// at java.base/sun.launcher.LauncherHelper.loadModuleMainClass(Unknown Source)
// at java.base/sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
requires com.github.kwhat.jnativehook;
opens org.jnativehook.example;
}