diff --git a/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java b/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java
index cdb7807081..1dcbb51be9 100644
--- a/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java
+++ b/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java
@@ -19,6 +19,8 @@ import org.openstreetmap.josm.cli.CLIModule;
 import org.openstreetmap.josm.data.coor.EastNorth;
 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.Logging;
 import org.openstreetmap.josm.tools.OptionParser;
 
 /**
@@ -74,10 +76,10 @@ public class ProjectionCLI implements CLIModule {
         try {
             run(fromStr, toStr, otherPositional);
         } catch (ProjectionConfigurationException | IllegalArgumentException | IOException ex) {
-            System.err.println(tr("Error: {0}", ex.getMessage()));
-            System.exit(1);
+            Logging.error(ex);
+            Lifecycle.exitJosm(true, 1);
         }
-        System.exit(0);
+        Lifecycle.exitJosm(true, 0);
     }
 
     /**
@@ -85,7 +87,7 @@ public class ProjectionCLI implements CLIModule {
      */
     private static void showHelp() {
         System.out.println(getHelp());
-        System.exit(0);
+        Lifecycle.exitJosm(true, 0);
     }
 
     private static String getHelp() {
diff --git a/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java b/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java
index 595d7d70c2..cd4164c37f 100644
--- a/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java
+++ b/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java
@@ -68,9 +68,9 @@ import org.openstreetmap.josm.tools.Utils;
  * @since 18365
  */
 public class ValidatorCLI implements CLIModule {
-	/**
-	 * The unique instance.
-	 */
+    /**
+     * The unique instance.
+     */
     public static final ValidatorCLI INSTANCE = new ValidatorCLI();
 
     /** The input file(s) */
@@ -384,7 +384,7 @@ public class ValidatorCLI implements CLIModule {
         switch (option) {
         case HELP:
             showHelp();
-            System.exit(0);
+            Lifecycle.exitJosm(true, 0);
             break;
         case DEBUG:
             this.logLevel = Logging.LEVEL_DEBUG;
diff --git a/src/org/openstreetmap/josm/gui/MainApplication.java b/src/org/openstreetmap/josm/gui/MainApplication.java
index 8aa31512fa..c2848b500f 100644
--- a/src/org/openstreetmap/josm/gui/MainApplication.java
+++ b/src/org/openstreetmap/josm/gui/MainApplication.java
@@ -276,8 +276,8 @@ public class MainApplication {
             try {
                 args = new ProgramArguments(argArray);
             } catch (IllegalArgumentException e) {
-                System.err.println(e.getMessage());
-                System.exit(1);
+                Logging.error(e);
+                Lifecycle.exitJosm(true, 1);
             }
             mainJOSM(args);
         }
@@ -1240,7 +1240,7 @@ public class MainApplication {
                     Logging.log(Logging.LEVEL_ERROR,
                             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;
                 }
             }
diff --git a/src/org/openstreetmap/josm/gui/mappaint/RenderingCLI.java b/src/org/openstreetmap/josm/gui/mappaint/RenderingCLI.java
index a92dd1780d..4ec4db901b 100644
--- a/src/org/openstreetmap/josm/gui/mappaint/RenderingCLI.java
+++ b/src/org/openstreetmap/josm/gui/mappaint/RenderingCLI.java
@@ -38,6 +38,7 @@ import org.openstreetmap.josm.gui.mappaint.RenderingHelper.StyleData;
 import org.openstreetmap.josm.io.Compression;
 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;
 import org.openstreetmap.josm.tools.Http1Client;
@@ -176,17 +177,17 @@ public class RenderingCLI implements CLIModule {
                 e.printStackTrace();
             }
             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()) {
                 e.printStackTrace();
             }
             if (e.getMessage() != null) {
-                System.err.println(tr("Error: {0}", e.getMessage()));
+                Logging.error(e);
             }
-            System.exit(1);
+            Lifecycle.exitJosm(true, 1);
         }
-        System.exit(0);
+        Lifecycle.exitJosm(true, 0);
     }
 
     /**
@@ -227,7 +228,7 @@ public class RenderingCLI implements CLIModule {
         switch (o) {
         case HELP:
             showHelp();
-            System.exit(0);
+            Lifecycle.exitJosm(true, 0);
             break;
         case DEBUG:
             argDebug = true;
