Skip to content

Instantly share code, notes, and snippets.

@androidfred
Last active October 27, 2021 03:21
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save androidfred/bc64da9e6a355b984d37439ed63ae16b to your computer and use it in GitHub Desktop.
Save androidfred/bc64da9e6a355b984d37439ed63ae16b to your computer and use it in GitHub Desktop.
java.lang.ClassNotFoundException: javafx.util.Pair

java.lang.ClassNotFoundException: javafx.util.Pair happens because javafx.util.Pair and other classes from javafx.util are not included in OpenJDK. Options for resolving:

Switch class

Map.Entry<K, V> from java.util is similar to javafx.util.Pair.

Install java-openjfx

Install java-openjfx through your package manager. (or whatever means you used to install Java on your machine) Note that java-openjfx is compatible with OpenJDK8, not previous versions.

After installing java-openjfx, you may have to add it manually to your IDE SDK classpath. Eg in IntelliJ, you may have to go to Project Structure | SDKs | <select your SDK> | Classpath | + (the Classpath +, not the SDKs +) | and add /usr/lib/jvm/java-8-openjdk/jre/lib/ext/jfxrt.jar (which should be there now that java-openjfx has been installed) | OK

Switch JDK

Switch to the Oracle JDK. (bleh)

KEYWORDS

How to tutorial setup openjdk openjfx classnotfoundexception javafx.util javafx.util.Pair IntelliJ IDEA compilation error doesn't compile not found

@velikanov
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment