Class Launcher

java.lang.Object
org.openpatch.scratch.Launcher

public final class Launcher extends Object
Starts a program so that its window runs on the process's first thread, which macOS requires (with -XstartOnFirstThread); the program's main runs on a second thread. Studio starts every run and every exported game this way; a plain java run does not need it.
java -XstartOnFirstThread -cp game.jar org.openpatch.scratch.Launcher MyGame
  • Method Details

    • isActive

      public static boolean isActive()
      Whether the window has to run on the first thread.
    • runOnFirstThread

      public static void runOnFirstThread(Runnable windowLoop)
      Hands the window loop to the first thread; it does not return before the program ends.
    • main

      public static void main(String[] args) throws Exception
      Parameters:
      args - the main class, then its arguments
      Throws:
      Exception - when the main class cannot be found