Heyo all, got a question about creating a runnable image which I'll eventually be packaging per platform. I have everything building into a runnable jar, but I want to package the runtime with it so that users don't have to worry about downloading anything other than my application itself. I'm using Java 12.
Here is the jlink line I'm using to try to use to create my image:
Unfortunately, none of the required modules are being recognized by jlink. It tells me that their layouts are missing (the module that it errors on is random, just one from the required list):
I have checked inside the jar file that the jmod was created from, and it contains the compiled classes of everything that should be needed. Is there a way to tell jlink how to find it all? Everything needed should be in there already. Appreciate any assistance.
Solved this myself and thought I would post the answer to anyone who happened across this with similar problems...
If you're going to use jlink in this manner, you should use a jar that has been built without dependencies. I was trying to use one that had been built with, which was where I was running into my problems. You will need to provide paths to copies of all modules that are required based on your requirements as defined in your module-info.java. Just as an example, here is what my jlink line looks like now (line breaks added for clarity, but cannot be present when executed):
If you try to link based on a jar that has been built with dependencies, you will run into problems. When you fail to provide module paths, jlink will not be able to link everything. When you do provide them, you will run into collisions, as they already exist within your archive.