Questions tagged [jlink]

jlink is a tool used in Java 9 or higher to assemble and optimize a set of modules and their dependencies into a custom runtime image. The tag can be used along with java9 or above tag mostly.

The several options used by the tool are documented here.. Its primary syntax is as follows:

jlink [options] --module-path modulepath --add-modules mods --output path
268 questions
9
votes
4 answers

Records in jlink:ed application throws exception

Using records (preview feature java-14) in a jlink:ed application, gives below error when using options: options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'] java.lang.ClassFormatError: Invalid constant pool index…
Aksel Willgert
  • 11,367
  • 5
  • 53
  • 74
9
votes
2 answers

JRE created via JLink missing some security certificates (cacerts)

I've created a minified JRE using the JLink tool jlink --add-modules java.base,jdk.crypto.ec --output jre I've created a very basic application that connects to https://www.example.com When I run this application using the JDK, everything works…
Jakg
  • 922
  • 12
  • 39
9
votes
2 answers

How to set VM options for JLink launcher executable

When using jlink, a bin/java file is generated. This executable will accept VM options by specifying options on the command line in the usual way (such as -Dsystem.property=value or -Xmx1G). jlink also provides a --launcher option to create an…
knaccc
  • 232
  • 2
  • 11
9
votes
3 answers

How to package app at Java 11 with non-modular dependencies

I develop and distribute a Java Swing app that uses Apache Batik and JavaCV. I've updated it through java 1.6, 7 and 8. Installers for macOS, Windows and Linux are built with Javapackager. Java 8 is end of support in Jan '19 and I can't find a…
Hamish258
  • 305
  • 2
  • 9
9
votes
1 answer

ModiTect and Jlink not finding module dependencies

I've configured ModiTect to generate module-info.javas for all my dependencies (that don't have them) and that seems to be working; but when it comes to dependencies that do have them, it's not finding them. For my own jars, I'm writing the…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
9
votes
3 answers

JDK 9 + Mac OS + jlink?

I installed the release version of JDK 9 on Mac OS. jshell works great, Jigsaw module support works, but there is no jlink: ➜ java --version java 9 Java(TM) SE Runtime Environment (build 9+181) Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed…
clay
  • 18,138
  • 28
  • 107
  • 192
8
votes
3 answers

Jdeps Module java.annotation not found

I'm trying to create a minimal jre for Spring Boot microservices using jdeps and jlink, but I'm getting the following error when I get to the using jdeps part Exception in thread "main" java.lang.module.FindException: Module java.annotation not…
Bryan Motta
  • 131
  • 7
8
votes
1 answer

Distributing JavaFX Applications that use automodules

I have created a JavaFX application. It runs perfectly in my Intellij IDE. Now I want to distribute the application - i.e. I want to obtain an installer that users could download and then it would install the application for them. I found a very…
Luk
  • 1,009
  • 2
  • 15
  • 33
8
votes
2 answers

jlink: service binding links many unnecessary modules

I face the problem that the service binding option of jlink links many, many modules, none of them seems to be necessary. These modules aren't linked when the service binding option is omitted. Questions: Q1: Do you see the same behavoir in your…
user120513
  • 531
  • 4
  • 12
8
votes
4 answers

Is there a way to add maven dependencies while using the maven-jlink-plugin?

I'm using this Github project to get exposed to the new modular features in Java 9. I would like to add dependencies to the project and be able to build a native image. However, when I try to add a new dependency to the pom.xml, and add the requires…
srestrepo
  • 99
  • 1
  • 5
8
votes
2 answers

Creating custom runtime image dedicated for specific modular application

Let's say I'm developing a modular application that consists of 2 modules: com.spacey.explorer that depends on com.spacey.rocket module. I have their modular JAR files in some bin directory. And I want to prepare lightweight JRE to run it. So…
malloc4k
  • 1,742
  • 3
  • 22
  • 22
7
votes
1 answer

Error: Hash of java.xml (...) differs to expected hash (...) recorded in java.base

Creating simple javafx 11 "hello world" application. Getting error while creating custom JRE. user@user:~/Desktop/javafx/hellofx$ ./run.sh Error: Hash of java.xml (c043b4c28b897656e2a4d36c92ba2f5d52134bce79643236dd36295e14178be7) differs to…
Paneer Handi
  • 115
  • 2
  • 10
7
votes
1 answer

Error: automatic module cannot be used with jlink: - Maven with JavaFX

I have selected Apache Commons IO, JSerialComm and Ini4J libraries via Maven repository. But when I try to create an image via mvn javafx:jlink I get this errors: [INFO] --- javafx-maven-plugin:0.0.2:jlink (default-cli) @ JUSBPlotter --- [WARNING]…
euraad
  • 2,467
  • 5
  • 30
  • 51
7
votes
1 answer

JavaFX Maven with moditect and Java 11

As per Is there a way to add maven dependencies while using the maven-jlink-plugin? Has anyone used ModiTect Maven plug-in with JavaFX in Java 11. I tried use the maven-jlink-plugin with: org.apache.maven.plugins
Mathew Dusome
  • 305
  • 3
  • 9
7
votes
1 answer

java 9: JLink created invalid images - missing module executable script

I am creating a sample application with 3 modules user, dept and account. In my user module, I have a main class and compile my modules with the following command: javac -d target --module-source-path src $(find -name "*.java") After compiling,…
Harmeet Singh Taara
  • 6,483
  • 20
  • 73
  • 126
1
2
3
17 18