Index: trunk/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java	(revision 18365)
+++ trunk/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java	(revision 18366)
@@ -20,4 +20,5 @@
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.coor.conversion.LatLonParser;
+import org.openstreetmap.josm.spi.lifecycle.Lifecycle;
 import org.openstreetmap.josm.tools.OptionParser;
 
@@ -76,7 +77,7 @@
         } catch (ProjectionConfigurationException | IllegalArgumentException | IOException ex) {
             System.err.println(tr("Error: {0}", ex.getMessage()));
-            System.exit(1);
+            Lifecycle.exitJosm(true, 1);
         }
-        System.exit(0);
+        Lifecycle.exitJosm(true, 0);
     }
 
@@ -86,5 +87,5 @@
     private static void showHelp() {
         System.out.println(getHelp());
-        System.exit(0);
+        Lifecycle.exitJosm(true, 0);
     }
 
Index: trunk/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java	(revision 18365)
+++ trunk/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java	(revision 18366)
@@ -69,7 +69,7 @@
  */
 public class ValidatorCLI implements CLIModule {
-	/**
-	 * The unique instance.
-	 */
+    /**
+     * The unique instance.
+     */
     public static final ValidatorCLI INSTANCE = new ValidatorCLI();
 
@@ -385,5 +385,5 @@
         case HELP:
             showHelp();
-            System.exit(0);
+            Lifecycle.exitJosm(true, 0);
             break;
         case DEBUG:
Index: trunk/src/org/openstreetmap/josm/gui/MainApplication.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 18365)
+++ trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 18366)
@@ -278,5 +278,5 @@
             } catch (IllegalArgumentException e) {
                 System.err.println(e.getMessage());
-                System.exit(1);
+                Lifecycle.exitJosm(true, 1);
             }
             mainJOSM(args);
@@ -1241,5 +1241,5 @@
                             tr("''{0}'' is not a valid value for argument ''{1}''. Possible values are {2}, possibly delimited by commas.",
                             s.toUpperCase(Locale.ENGLISH), Option.OFFLINE.getName(), Arrays.toString(OnlineResource.values())), e);
-                    System.exit(1);
+                    Lifecycle.exitJosm(true, 1);
                     return;
                 }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/RenderingCLI.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/RenderingCLI.java	(revision 18365)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/RenderingCLI.java	(revision 18366)
@@ -39,4 +39,5 @@
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
+import org.openstreetmap.josm.spi.lifecycle.Lifecycle;
 import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.spi.preferences.MemoryPreferences;
@@ -177,5 +178,5 @@
             }
             System.err.println(tr("Error - file not found: ''{0}''", e.getMessage()));
-            System.exit(1);
+            Lifecycle.exitJosm(true, 1);
         } catch (IllegalArgumentException | IllegalDataException | IOException e) {
             if (Logging.isDebugEnabled()) {
@@ -185,7 +186,7 @@
                 System.err.println(tr("Error: {0}", e.getMessage()));
             }
-            System.exit(1);
-        }
-        System.exit(0);
+            Lifecycle.exitJosm(true, 1);
+        }
+        Lifecycle.exitJosm(true, 0);
     }
 
@@ -228,5 +229,5 @@
         case HELP:
             showHelp();
-            System.exit(0);
+            Lifecycle.exitJosm(true, 0);
             break;
         case DEBUG:
