Index: trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 12129)
+++ trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 12130)
@@ -1405,5 +1405,4 @@
     /**
      * Updates system properties with the current values in the preferences.
-     *
      */
     public void updateSystemProperties() {
@@ -1417,5 +1416,5 @@
         // Force AWT toolkit to update its internal preferences (fix #6345).
         // Does not work anymore with Java 9, to remove with Java 9 migration
-        if (!GraphicsEnvironment.isHeadless()) {
+        if (Utils.getJavaVersion() < 9 && !GraphicsEnvironment.isHeadless()) {
             try {
                 Field field = Toolkit.class.getDeclaredField("resources");
Index: trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 12129)
+++ trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 12130)
@@ -1586,3 +1586,24 @@
         return angleDeg * TO_RADIANS;
     }
+
+    /**
+     * Returns the Java version as an int value.
+     * @return the Java version as an int value (8, 9, etc.)
+     * @since 12130
+     */
+    public static int getJavaVersion() {
+        String version = System.getProperty("java.version");
+        if (version.startsWith("1.")) {
+            version = version.substring(2);
+        }
+        // Allow these formats:
+        // 1.8.0_72-ea
+        // 9-ea
+        // 9
+        // 9.0.1
+        int dotPos = version.indexOf('.');
+        int dashPos = version.indexOf('-');
+        return Integer.parseInt(version.substring(0,
+                dotPos > -1 ? dotPos : dashPos > -1 ? dashPos : 1));
+    }
 }
