5

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 JRE using java9 'jlink' I get the following :

/out$ jlink --module-path production --add-modules  
studyModule,java.base,java.datatransfer,java.desktop,java.logging,
java.scripting,java.sql,java.xml,java.prefs,javafx.base,
javafx.controls,javafx.fxml,javafx.graphics,javafx.media,
javafx.swing,javafx.web,jdk.jsobject,jdk.xml.dom,jdk.unsupported 
--output studyJre
Error: module-info.class not found for com.zaxxer.hikari module

/out$ jlink --module-path production --add-modules   
studyModule,java.base,java.datatransfer,java.desktop,java.logging,   
java.scripting,java.sql,java.xml,java.prefs,javafx.base,
javafx.controls,javafx.fxml,javafx.graphics,javafx.media,
javafx.swing,javafx.web,jdk.jsobject,jdk.xml.dom,jdk.unsupported 
--output studyJre
Error: module-info.class not found for poi module

questions is : why those packages with the IDE works fine ? if they not been moduleized then should not work in the IDE as well .

P.S : I added those jars to the "root" folder when working with jlink.

ZhekaKozlov
  • 36,558
  • 20
  • 126
  • 155
Mohd
  • 191
  • 3
  • 14

1 Answers1

3

Remember that jlink is a non-standard tool and it does not have to follow exactly the same rules as classic Java. One of its differences is that it requires all modules to be explicit (i.e. have module-info.class). Automatic modules are not supported. If you want to make a custom runtime image, you have to convert all automatic modules to explicit ones. See, for example, this question to know how to achieve it.

ZhekaKozlov
  • 36,558
  • 20
  • 126
  • 155
  • @ZhekaKozlov...I got you point with the jlink. Will try the way as mentioned in the link...seems the jdeps will get things done. Anyway, thanks for your help. – Mohd Apr 16 '18 at 13:51
  • ...I tried the way mentioned in your link, with the jdeps of Philip ; on HikariCP-3.1.0.jar & poi-3.17.jar ...I get (Missing dependence: ./poi/module-info.java not generated ) with lots of dependencies names...why this way no works in my case ? – Mohd Apr 17 '18 at 02:54