cannot to add module to jpackage-created application

i’m having a problem connecting my jpackage-created application to websocket endpoint. the cipher that is negotiated when running via my IDE is not available in the built image. it appears i’m encountering the issue described here: https://www.gubatron.com/blog/2019/04/25/solving-received-fatal-alert-handshake_failure-error-when-performing-https-connections-on-a-custom-made-jre-with-jlink/

i’m now trying to add jdk.crypto.cryptoki to my jpackage and not able to.

i first tried this

runtime {     options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']     jpackage {         imageName = 'MyCorpDashboard'         installerName = 'MyCorpInstaller'         appVersion = '0.1.0'         if(org.gradle.internal.os.OperatingSystem.current().windows) {             jpackageHome = 'D:\\Java\\jdk-14' // Needs to be JDK 14             installerType = 'exe'             jvmArgs = ['-Djava.security.debug=access,stack',                        '-Dhttps.protocols=SSLv2,TLSv1.2',                        '-Djavax.net.debug=ssl:handshake:verbose'                        '--add-modules', 'jdk.crypto.cryptoki']             imageOptions = ['--win-console', '--icon','src/main/resources/com/mycorp/ui/dashboard/icon_wh.ico']             installerOptions = ['--win-per-user-install',                             '--win-dir-chooser',                             '--win-menu',                             '--win-shortcut',                             '--vendor', 'My Corp']         } else if (org.gradle.internal.os.OperatingSystem.current().macOsX) {             jpackageHome = '/Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/' // Needs to be JDK 14             imageOptions = ['--vendor', 'My Corp',                             '--icon','src/main/resources/com/mycorp/ui/dashboard/icon_wh.icns']         }     } } 

but get

Error occurred during initialization of boot layer java.lang.module.FindException: Module jdk.crypto.cryptoki not found 

i also tried

compileJava {     options.compilerArgs += ["--add-modules", "jdk.crypto.cryptoki"] } 

and that did not work either.

how can i add this module so that it is packaged with my application?

Add Comment
1 Answer(s)

oi – right after posting i think i see it now, under runtime (after revisiting https://badass-runtime-plugin.beryx.org/releases/latest/)

runtime {     options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']     modules = ['jdk.crypto.cryptoki']     jpackage {         imageName = 'MyCorpDashboard'         installerName = 'MyCorpInstaller'         appVersion = '0.1.0'         if(org.gradle.internal.os.OperatingSystem.current().windows) {             jpackageHome = 'D:\\Java\\jdk-14' // Needs to be JDK 14             installerType = 'exe'             jvmArgs = ['-Djava.security.debug=access,stack',                        '-Dhttps.protocols=SSLv2,TLSv1.2',                        '-Djavax.net.debug=ssl:handshake:verbose']             imageOptions = ['--win-console', '--icon','src/main/resources/com/mycorp/ui/dashboard/icon_wh.ico']             installerOptions = ['--win-per-user-install',                             '--win-dir-chooser',                             '--win-menu',                             '--win-shortcut',                             '--vendor', 'My Corp']         } else if (org.gradle.internal.os.OperatingSystem.current().macOsX) {             jpackageHome = '/Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/' // Needs to be JDK 14             imageOptions = ['--vendor', 'My Corp',                             '--icon','src/main/resources/com/mycorp/ui/dashboard/icon_wh.icns']         }     } } 
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.