Closed Parth closed 5 years ago
Also, my project seemed to suffer from runtime
not detecting one of the modules it depends on. When I add that module, javafx can't seem to find the modules it needs.
https://stackoverflow.com/questions/55439599/sslhandshakeexception-with-jlink-created-runtime
How did you add the missing module?
So initially I tried suggestModules
, which fixed my JavaFX
errors but jgit
's SSL
operations were breaking. I googled and that stackoverflow told me to add jdk.crypto.ec
. It just bothers me that these failures don't happen at compile time, so it's very hard to detect that they're present. I'm tempted to simply add all the modules to guarantee robustness.
Output of suggestModules
:
> Task :compileJava NO-SOURCE
> Task :compileScala UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :jar UP-TO-DATE
> Task :suggestModules
modules = [
'java.security.jgss',
'java.xml',
'java.desktop',
'jdk.unsupported',
'java.management']
BUILD SUCCESSFUL in 3s
3 actionable tasks: 1 executed, 2 up-to-date
Sometimes the plugin is not able to detect all required modules. If you want to be sure that no module is missing, try to configure: modules = ['java.se']
. This way, all modules will be included in your image. The only downside is that the resulting image will be bigger than strictly necessary.
EDIT: you may still need to add some other jdk modules, such as jdk.unsupported
.
What set of modules covers everything, for sure? I'd happily trade larger application size for no runtime errors.
What is the jdk
equivalent of java.se? And are their other things I'm not thinking off?
There is no aggregator module (similar to java.se) that includes all jdk modules.
You can see the list of all modules by executing:
java --list-modules
You can include all jdk modules from the above list, but I don't think this is a good idea. Unless your application is an IDE or a developer tool, you probably don't need "tool" modules such as: jdk.jartool, jdk.javadoc, jdk.jcmd, jdk.jconsole, jdk.jdeps, jdk.jlink, jdk.jshell, etc.
Moreover, the jdk modules are internal API. The sets of existing jdk modules differ between JVM implementations (for example, between HotSpot and OpenJ9) and very often between different Java releases.
My suggestion is to include only the jdk modules below. There is no guarantee, but I'm pretty sure they are more than enough for your application.
jdk.accessibility jdk.charsets jdk.crypto.cryptoki jdk.crypto.ec jdk.crypto.mscapi jdk.httpserver jdk.jsobject jdk.localedata jdk.net jdk.security.auth jdk.security.jgss jdk.unsupported jdk.unsupported.desktop jdk.xml.dom
Okay so I'll do java.se
& the ones you listed above. Could you share how you gained this intuition? Do you think I should just go through and read about each module to demystify this a bit?
Do you think I should just go through and read about each module to demystify this a bit?
That's what I actually did to compile the above list of modules.
https://github.com/beryx-gist/badass-jlink-example-kotlin-javafx/issues/2