JAL-629 Fix Exceptions when running with CLI not headless
[jalview.git] / src / jalview / bin / Jalview.java
index 99ae815..3cc71af 100755 (executable)
@@ -378,19 +378,6 @@ public class Jalview
 
     if (argparser.isSet(Arg.HEADLESS))
       headless = argparser.getBool(Arg.HEADLESS);
-    boolean commandsSuccess = Commands.processArgs(argparser, headless);
-    if (commandsSuccess)
-    {
-      Console.info("Successfully completed commands");
-      if (headless)
-        System.exit(0);
-    }
-    else
-    {
-      Console.warn("Error when running commands");
-      if (headless)
-        System.exit(1);
-    }
 
     if (!Platform.isJS())
     /**
@@ -613,6 +600,20 @@ public class Jalview
         }
       }
     }
+    // Run Commands from cli
+    boolean commandsSuccess = Commands.processArgs(argparser, headless);
+    if (commandsSuccess)
+    {
+      Console.info("Successfully completed commands");
+      if (headless)
+        System.exit(0);
+    }
+    else
+    {
+      Console.warn("Error when running commands");
+      if (headless)
+        System.exit(1);
+    }
 
     // Check if JVM and compile version might cause problems and log if it
     // might.