0

I have an old project I am migrating from Java 8 to Java 11.

When compiling the project I use these VM options:

--module-path /path/to/javafx-sdk-11.0.2/lib --add-modules=javafx.controls,javafx.fxml,javafx.swing,javafx.graphics,javafx.media,javafx.web --add-reads javafx.graphics=ALL-UNNAMED --add-opens javafx.controls/com.sun.javafx.charts=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.iio=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.iio.common=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.css=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.runtime=ALL-UNNAMED

I don't know why but when launching the project in Intellij it throws the following erro:

Error:(4, 27) java: package netscape.javascript does not exist

Error:(68, 19) java: cannot find symbol symbol: class JSObject

But as far as I know, JSObject is still available in Java11, right? https://docs.oracle.com/en/java/javase/11/docs/api/jdk.jsobject/netscape/javascript/JSObject.html I see one deprecated method but the class is still available.

What can be the issue?

Community
  • 1
  • 1
victor.alm
  • 480
  • 1
  • 7
  • 16
  • Do you now have to do an OpenJDK download as in https://hg.openjdk.java.net/jdk/jdk11/file/1ddf9a99e4ad/src/jdk.jsobject/share/classes/netscape/javascript? – ForceRs May 12 '20 at 19:31

1 Answers1

1

I had a similar problem, I had to add this:

--add-modules jdk.jsobject --add-exports=javafx.web/com.sun.javafx.webkit=ALL-UNNAMED

Not sure if you need the --add-exports part, but probably the first part is important, since the jdk.jsobject module is what contains the netscape.javascript.JSObject class.

Hope that helps a bit...

theothertom
  • 141
  • 2
  • 3