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
5
votes
1 answer

Is it possible to start a Java Runtime Image with prunsrv using jvm mode?

Background: Since Java 9 it is possible to create custom runtime images (JRE+program) using jlink. It is possible to install Java programs as Windows service using prunsrv.exe (part of Apache Commons Daemon). prunsrv can be used in three start…
Gustave
  • 3,359
  • 4
  • 31
  • 64
5
votes
1 answer

Compile Module that Depends on an External Jar

I worked through a simple example using Project Jigsaw in Java 11.0.1, built using the oracle JDK 11 on Ubuntu 18.04. Following that example, I have created a simple project which compiles to a module, packages the module into a jar, and then uses…
Grumblesaurus
  • 3,021
  • 3
  • 31
  • 61
5
votes
2 answers

Getting a Mathematica image in Java

I am attempting to use J/Link to get an image from Mathematica to Java. I am able to print the image in Mathematica like this: Print[ Graphics[Raster[ img[[1]] ], AspectRatio->Automatic, ImageSize->530 ] ]; I've tried returning the data from the…
rmw
  • 1,253
  • 1
  • 12
  • 20
5
votes
0 answers

Class not found in Spring when using Java modules and jlink

I'm adding module definitions to Spring Boot to be able to jlink my project. One of the errors I encountered is: Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException:…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
5
votes
1 answer

java 9 third party modules works with IDE but not with jlink

The program based on JDK 9(JPMS), using some third party jars like Apache (poi-3.17.jar, commons-io-2.6.jar ) & HikariCP (HikariCP-3.1.0.jar) , when using the IDE(Intellij) I "requires" them and the program works fine . When I try get my customeized…
Mohd
  • 191
  • 3
  • 14
5
votes
2 answers

Java9 packager with jlink compress tags

when we create jlink runtime images we can use tags such as '--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages' , creating a distribution folder around 45mb. If we want to use javapackager, for example to create an .DMG file,…
4
votes
0 answers

Using Moditect to add module-info to existing maven dependencies

I am using JavaFX and have some dependencies that are not automatic modules. When trying to run mvn clean javafx:jlink I get the following error: Error: automatic module cannot be used with jlink: org.apache.commons.io from [...]` This also…
Conor Egan
  • 518
  • 1
  • 3
  • 21
4
votes
1 answer

How to get a resources path after jlink-ing?

I am trying to make my JavaFx-Application executable using Maven and Visual Studio Code. After some time spent on this topic, I found some posts mentioning jlink. I am a newcomer when it comes to packaging Java/JavaFX applications, so I gave it a…
4
votes
1 answer

Error: Module java.base not found, required by while trying jlink on Fedora

When trying to use jlink on Fedora from this plugin https://github.com/openjfx/javafx-maven-plugin org.openjfx javafx-maven-plugin 0.0.8 Pom.xml
Alcamech
  • 177
  • 1
  • 2
  • 13
4
votes
1 answer

javafx 16 WebEngine Exception "SSL Handshake failed"

I am porting an android app to javaFX for windows deployment, i'm new to javaFX and desktop deployment, but not so new to java. The app contains a WebView that loads a url obtained from a server via Json (so could be essentially anything). openJDK…
Tim W
  • 91
  • 5
4
votes
1 answer

Using ModiTect to generate module info and create runtime image

Tried to use JLink to create a runtime image, however: Error: automatic module cannot be used with JLink: graphviz.java I'm using the following library which has only automatic modules. Did some searches, and it seems that I can use ModiTect to…
4
votes
2 answers

Unexpected behaviour from Gson

I developed a small application that stores data coming from a device: I chose to store data in JSON format, and the serialization/deserialization of the data works just fine, even if it involves some custom types created by me...but only I work in…
il_boga
  • 1,305
  • 1
  • 13
  • 21
4
votes
1 answer

Custom JRE produced by jlink has a large size for a minimal jre

I am trying to provide a minimal JRE for a slim Docker image. With jlink 11.0.4, which comes with open-jdk-11 on Ubuntu, the image built with this custom JRE is actually larger than what it would be with a default JRE. I think this is due to a very…
4
votes
1 answer

java.nio.file.ProviderNotFoundException with jlink created runtime

I am working on adopting jlink in order to create a much smaller runtime to embed with the macOS application version of a free software package, and I nearly have it working (with my application shrinking from around 260MB to 90MB). The problem that…
James Elliott
  • 694
  • 8
  • 14
4
votes
0 answers

@ComponentScan does not detect beans in a jlink'ed Java runtime image

I'm using JavaFX on Java 11 to create a desktop app. The app is bundled into a custom runtime image with all its modules and their dependencies using jlink. For dependency injection, the app relies on the Spring Framework. I'm aware that Spring…
IggyBlob
  • 372
  • 2
  • 13