Index: trunk/src/org/openstreetmap/josm/gui/MainApplication.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 14176)
+++ trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 14177)
@@ -6,4 +6,5 @@
 import static org.openstreetmap.josm.tools.Utils.getSystemProperty;
 
+import java.awt.AWTError;
 import java.awt.Container;
 import java.awt.Dimension;
@@ -874,5 +875,5 @@
                 args.getSingle(Option.GEOMETRY).orElse(null),
                 !args.hasOption(Option.NO_MAXIMIZE) && Config.getPref().getBoolean("gui.maximized", false));
-        final MainFrame mainFrame = new MainFrame(geometry);
+        final MainFrame mainFrame = createMainFrame(geometry);
         final Container contentPane = mainFrame.getContentPane();
         if (contentPane instanceof JComponent) {
@@ -1016,4 +1017,15 @@
             Logging.info("Enabled EDT checker, wrongful access to gui from non EDT thread will be printed to console");
             RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager());
+        }
+    }
+
+    private static MainFrame createMainFrame(WindowGeometry geometry) {
+        try {
+            return new MainFrame(geometry);
+        } catch (AWTError e) {
+            // #12022 #16666 On Debian, Ubuntu and Linux Mint the first AWT toolkit access can fail because of ATK wrapper
+            // Good news: the error happens after the toolkit initialization so we can just try again and it will work
+            Logging.error(e);
+            return new MainFrame(geometry);
         }
     }
Index: trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java	(revision 14176)
+++ trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java	(revision 14177)
@@ -49,7 +49,15 @@
     @Override
     public void preStartupHook() {
-        // See #12022 - Disable GNOME ATK Java wrapper as it causes a lot of serious trouble
-        if ("org.GNOME.Accessibility.AtkWrapper".equals(getSystemProperty("assistive_technologies"))) {
-            System.clearProperty("assistive_technologies");
+        // See #12022, #16666 - Disable GNOME ATK Java wrapper as it causes a lot of serious trouble
+        if (isDebianOrUbuntu()) {
+            if (Utils.getJavaVersion() >= 9) {
+                // TODO: find a way to disable ATK wrapper on Java >= 9
+                // We should probably be able to do that by embedding a no-op AccessibilityProvider in our jar
+                // so that it is loaded by ServiceLoader without error
+                // But this require to compile at least one class with Java 9
+            } else {
+                // Java 8 does a simple Class.newInstance() from system classloader
+                Utils.updateSystemProperty("javax.accessibility.assistive_technologies", "java.lang.Object");
+            }
         }
     }
