MachinePublishers / jBrowserDriver

A programmable, embeddable web browser driver compatible with the Selenium WebDriver spec -- headless, WebKit-based, pure Java
Other
809 stars 143 forks source link

Running in java 9 build 9-ea+139 fails to start remote browser #205

Open Bbbrinks opened 7 years ago

Bbbrinks commented 7 years ago

It fails with the following error:

[2016-10-13T13:33:19.180] Unrecognized option: -XaddExports:javafx.web/com.sun.webkit.network=ALL-UNNAMED
[2016-10-13T13:33:19.180] Error: Could not create the Java Virtual Machine.
[2016-10-13T13:33:19.180] Error: A fatal exception has occurred. Program will exit.
[2016-10-13T13:33:19.185] Unrecognized option: -XaddExports:javafx.web/com.sun.webkit.network=ALL-UNNAMED
[2016-10-13T13:33:19.185] Error: Could not create the Java Virtual Machine.
[2016-10-13T13:33:19.185] Error: A fatal exception has occurred. Program will exit.

java -version:

java version "9-ea" Java(TM) SE Runtime Environment (build 9-ea+139) Java HotSpot(TM) 64-Bit Server VM (build 9-ea+139, mixed mode)

I got it working with this workaround:

Instead of using exportModules = true

javaOptions("--add-exports=javafx.web/com.sun.webkit.network=ALL-UNNAMED",
                                    "--add-exports=javafx.web/com.sun.webkit.network.about=ALL-UNNAMED",
                                    "--add-exports=javafx.web/com.sun.webkit.network.data=ALL-UNNAMED",
                                    "--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED",
                                    "--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED",
                                    "--add-exports=java.base/sun.net.www.protocol.file=ALL-UNNAMED",
                                    "--add-exports=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED",
                                    "--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED",
                                    "--add-exports=java.base/sun.net.www.protocol.mailto=ALL-UNNAMED",
                                    "--add-exports=javafx.graphics/com.sun.glass.ui=ALL-UNNAMED",
                                    "--add-exports=javafx.web/com.sun.javafx.webkit=ALL-UNNAMED",
                                    "--add-exports=javafx.web/com.sun.webkit=ALL-UNNAMED");
hollingsworthd commented 7 years ago

Thanks for the info! Looks like Java 9 changed a little bit since that code was added, and now --add-exports is a standard option instead of a non-standard Oracle extension (-X)