jBrowserDriver icon indicating copy to clipboard operation
jBrowserDriver copied to clipboard

Support Java 11

Open boyarsky opened this issue 7 years ago • 11 comments

This is related to #285 . Java 11 is a long term support release so more people will be switching to it than Java 9. Also the problem got worse with Java 11. The version of Java FX for Java 11 (open jfx) - https://mvnrepository.com/artifact/org.openjfx gets past the Cookie Manager class not found.

However, Java 11 moves the Robot class from com.sun.glass.ui to javafx.scene.robot. This means that you can’t just use OpenJFX’s version of JavaFX with JDK 11. And since Java FX is tied to the version of Java, you can't use the old Java 8 JavaFX jar.

This means JBrowser Driver is stuck on Java 8 until you explicitly add support for Java 11. I hope this is on the radar. This project is the only headless driver I've found for Java that doesn't require installing anything on the server. Over time, having to stay on Java 8 will become an even bigger problem.

boyarsky avatar Nov 24 '18 15:11 boyarsky

I have tried getting it to work: https://github.com/ArloL/jBrowserDriver/tree/jdk11

I am stuck that CookieManager.setDefault throws an Exception when starting the server. Eclipse also says that method is not accesible. Anyone got an idea?

ArloL avatar Dec 20 '18 09:12 ArloL

Any change on this? I am interested in trying this out but have to use jdk11.

BrendM avatar Jan 08 '19 16:01 BrendM

@ArloL Maybe like this: https://stackoverflow.com/questions/47262810/eclipse-java9-how-to-access-internal-javafx-packages/47265176#47265176

zli-ray avatar Jan 12 '19 16:01 zli-ray

That’s not the problem. You can run non module code in Java 11. The problem is a Java 8 specific JavaFX API.

On Sat, Jan 12, 2019 at 11:37 AM zli-ray [email protected] wrote:

@ArloL https://github.com/ArloL Maybe should put a module-info.java into jBrowserDriver to make it a modular.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MachinePublishers/jBrowserDriver/issues/341#issuecomment-453761539, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZcnrKhcs7SaqKtfBV7fHxwOgsRYFw3ks5vCg9RgaJpZM4YxeV0 .

boyarsky avatar Jan 12 '19 18:01 boyarsky

@ArloL @boyarsky I cloned ArloL's branch : ArloL/jBrowserDriver/tree/jdk11, and tested it in my eclipse. It seems that it works good. (I changed nothing.)

Below are my pom.xml, test code and screenshot.

pom and test code.zip

screenshot

zli-ray avatar Jan 13 '19 14:01 zli-ray

@ArloL @boyarsky I cloned ArloL's branch : ArloL/jBrowserDriver/tree/jdk11, and tested it in my eclipse. It seems that it works good. (I changed nothing.)

Below are my pom.xml, test code and screenshot.

pom and test code.zip

screenshot

@ArloL Excellent! Based on the success of @zli-ray , I have also cloned your new branch ArloL/jBrowserDriver/tree/jdk11 and then deployed a new JAR file "jbrowserdriver-1.0.2-SNAPSHOT.jar" utilizing your new XML file "pom.xml". With the new JAR, I can concur with @zli-ray that it is working for JDK 11+ based on the following 2 dependencies:

  1. [JDK 11] http://oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html
  2. [JavaFX 11] http://gluonhq.com/products/javafx

@ArloL Would you please promote the new version "1.0.2-SNAPSHOT" to production? Thank you very much!

Please note that I need to use the flag "--jbd.javaoptions" for the following 11 Java options (which must be separated by tab) for JDK 11+: --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 --add-exports javafx.web/com.sun.webkit.network=ALL-UNNAMED --add-modules=ALL-MODULE-PATH --module-path [the local path to JavaFX 11, for example, /usr/local/javafx-sdk-11.0.2/lib]

tatklim avatar May 09 '19 11:05 tatklim

@ArloL As an added bonus, I have successfully tested your new branch ArloL/jBrowserDriver/tree/jdk11 in headless mode using Monocle and can confirm it is working for JDK 11+ based on the following 3 dependencies:

  1. [JDK 11] http://oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html
  2. [JavaFX 11] http://gluonhq.com/products/javafx
  3. [OpenJFX Monocle jdk-11+26] http://central.maven.org/maven2/org/testfx/openjfx-monocle/jdk-11+26/openjfx-monocle-jdk-11+26.jar

@ArloL Would you please promote the new version "1.0.2-SNAPSHOT" to production? Thank you very much!

In headless mode, I need to use the flag "--jbd.javaoptions" for the following 13 Java options (which must be separated by tab) for JDK 11+: -Dglass.platform=Monocle -Dmonocle.platform=Headless --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 --add-exports javafx.web/com.sun.webkit.network=ALL-UNNAMED --add-modules=ALL-MODULE-PATH --module-path [the local path to JavaFX 11, for example, /usr/local/javafx-sdk-11.0.2/lib]

tatklim avatar May 09 '19 11:05 tatklim

Any plans to merge this?

sorin-costea avatar Jun 10 '20 19:06 sorin-costea

Hi,

I updated the code to use openjfx 16 (that is compatible with JDK 11). I created a fork and released it to maven central with a different groupId. Feel free to merge back the changes to this repo.

It is available at https://github.com/everit-org/jBrowserDriver

balazs-zsoldos avatar Apr 04 '21 21:04 balazs-zsoldos

@balazs-zsoldos could you share the gav coordinates?

Gotcha implementation("org.everit.forks:org.everit.forks.com.machinepublishers.jbrowserdriver:1.1.1-jdk11.1") but still fails with jdk11 unfortunately..

elect86 avatar Jul 05 '22 07:07 elect86

@elect86 Works for us. However, we decided to leave jbrowserdriver behind as nobody maintains it and it does not work on Java 17. We use simple selenium webdriver instead (e.g.: chrome webdriver)

balazs-zsoldos avatar Jul 11 '22 05:07 balazs-zsoldos