0

I have just start a SPRING BOOT project using :

  • Jdk-17.0.5
  • Maven

When I run the project I get the exception below : Error occurred during initialization of boot layer java.lang.LayerInstantiationException: Package jdk.internal.jimage.decompressor in both module jrt.fs and module java.base

I have read this answer , but I did not find this folder javafx in JAVA_HOME/lib/ as it was montioned in the solution.

This is what I have at lib folder :

enter image description here

ayada
  • 412
  • 1
  • 12
  • The system library of Java 17 contains the module `java.base` which contains the package `jdk.internal.jimage.decompressor`. The system library of Java 17 does not contain the module `jrt.fs`, so it comes from your code or more likely from a dependency. Two modules must not contain the same package, and of course the system library follows this rule. – howlger Dec 12 '22 at 15:21
  • 1
    Which version of **Spring Boot** are you using? Is it compatible with Java 17? – nitind Dec 12 '22 at 15:51
  • @nitind I use **Spring boot 3.0.0** , from [the documentaion](https://docs.spring.io/spring-boot/docs/current/reference/html/getting-started.html#getting-started.system-requirements) this version of spring boot is **compatible** with **Java 17**. I use **Spring Tools 4** (4.17.0), can this affect the project? – ayada Dec 13 '22 at 08:54
  • 1
    The answer you have linked doesn’t say anything about javafx. As it says, you have to remove the `jrt-fs.jar` from the module path, regardless of how it got there. – Holger Dec 13 '22 at 09:00
  • @howlger from the exception, I understand the opposite of what you have said. We have two emplacement of the package `jdk.internal.jimage.decompressor`, the first one is on `java.base` and the other one is on `jrt.fs`. This is the same thing that confirm [this answer](https://stackoverflow.com/a/43014416/20757134) – ayada Dec 13 '22 at 09:03
  • The mentioned answer does not apply to an unmodified Java 17 JDK. Please go to your run configuration and click the _Show command line_ button and add the command line to your question. The command line tells which Java installation is used. Maybe you are looking at the wrong one. Please also show your `pom.xml`. If possible, provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – howlger Dec 13 '22 at 09:38

1 Answers1

1

@Holger and @nitind, Thank you for your help. In fact, i was using bad way to run my app. I was using : Run As then Run Configuration then Spring Boot then new configuration. Now I go to the Main class and I Run As Java Application.

ayada
  • 412
  • 1
  • 12