Search code examples
eclipsejavafximportjava-8openjdk-11

Eclipse Java 11 do not see external libs that were for older version (java 8)


I have just updated my eclipse project from java 8 to java 11. But I am using external libraries in this project that were designed for java 8. I have successfully imported these libs into projects classpath as it used to be but eclipse just refuses to use them. When I try to import them it will highlight it as an error with a message "The type bla.bla.Foo is not accessible". I also tried to import these libs into projects modulepath and requires them in module-info.java which solves the problem in some way but I still keep receiving warning "Name of automatic module 'SomeLib' is unstable, it is derived from the module's file name." and "The type Foo from module SomeLib may not be accessible to clients due to missing 'requires transitive'" always when I try to use an object from these libs.

Note: I am using OpenJDK 11 with JavaFX 11.
Note: Libs that I am trying to import are https://github.com/PetoPetko/JavaFx-Image-Animation
Note: I'm also getting "The type com.sun... is not accessible" also on everything that is from com.sun... package but I'm not sure if this is related to this problem.


Solution

  • Well, I manage to solve this by myself in probably the most primitive way... I simply import JavaFX into classpath and manually delete module-info.class from every JavaFx jar file making JavaFx not modular. Then I just run an app with the mentioned VM arguments and everything was just fine!
    I am sure many of you will be able to give me 10 reasons why removing module-info.class from existing lib is a bad idea but... if it works, and still I think there is no other solution to make my not modular project work with JavaFx 11.