Search code examples
javafxwebview

No jfxwebkit in java.library.path


I'm actually about to rip my hair out at this one... I'm trying to get a JavaFX WebView to work, but to no avail. Other answers on StackOverflow talk about ensuring my JDK is a full JDK that includes JavaFX and all its associated libraries, but that is already the case for me. And weirdly enough, in another IntelliJ project with the exact pom.xml file, the WebView works! I've been looking through the diff in git to find out what could have fixed that, but nothing stands out. The correct libraries also seem to be present in the IntelliJ libraries file tree, similarly to the project that enter image description here

When I try creating an instance of WebView like so new WebView(), it immediately throws this error: java.lang.UnsatisfiedLinkError: no jfxwebkit in java.library.path:...

Anybody with experience using WebView on a Mac, and can give some guidance on how to properly add the WebView to my Java libraries? It's very puzzling almost the same config on another project works perfectly fine, but when used in my actual project, doesn't work at all.


Solution

  • The solution was actually something to do with the JDK I ran it with. It appears that on my M1 Pro Mac, only a "full" JDK that included JavaFX could run the project properly, irregardless of project. The only JDK that still includes JavaFX that I could find was Liberica JDK, which still provides "full" JDKs up to JDK 19, which includes JavaFX.