1

Im exploring java9 and Im tring to create a custom jre following this link. But Im getting IllegalArgumentException.Below is my folder structure after compilation .

out
|->moduleA
|    |->module-info.java
|    |->pkg1
|        |->Test.class
|
|->java.base.jmod

Im able to run my program with default jre.But when I tried creating custom jre using the following command :jlink --module-path out --add-modules moduleA,java.base --output customjre

I get Error: java.lang.IllegalArgumentException

Im not sure what Im missing.Any help will be really useful.

Community
  • 1
  • 1
george
  • 339
  • 3
  • 12
  • 1
    Can you paste the full error message? – ZhekaKozlov Jul 01 '18 at 13:40
  • And the details of the tools or the JDK(version etc) would also be good to have in the question. – Naman Jul 01 '18 at 14:11
  • @ ZhekaKozlov It is the only message i got in the console – george Jul 02 '18 at 04:32
  • @nullpointer the jdk version is 9.0.4. – george Jul 02 '18 at 04:33
  • Do you really have a `module-info.java` in your output folder? You should compile `module-info.java` like any other `*.java` file and have a `module-info.class` in your output folder. And why do you have a `java.base.jmod` in your output folder? – Holger Jul 02 '18 at 07:32
  • I suggest to read [the tool documentation](https://docs.oracle.com/javase/9/tools/jlink.htm) instead of some spurious tutorials. You are not supposed to mess around with jdk modules; since your module does already declare all dependencies, `jlink` will know which jdk modules it needs to include… – Holger Jul 02 '18 at 07:49
  • I assume it means module-info.class rather than module-info.java, otherwise the error would be "ModuleA not found". I'm 99% sure the issue is that the java.base.jmod has been copied from a JDK 10 (or JDK 11 EA) and he's using JDK 9 jlink. – Alan Bateman Jul 03 '18 at 16:08

0 Answers0