예제 #1
0
  public static void main(String[] args) {
    // Ensure we're not running on GCJ, since it's not supported and leads to weird errors
    if (Platform.IS_GCJ) {
      System.err.println("Fatal: GCJ (GNU Compiler for Java) is not supported by JRuby.");
      System.exit(1);
    }

    Main main = new Main();

    try {
      int status = main.run(args);
      if (status != 0) {
        System.exit(status);
      }
    } catch (RaiseException re) {
      throw re;
    } catch (Throwable t) {
      // print out as a nice Ruby backtrace
      System.err.println(ThreadContext.createRawBacktraceStringFromThrowable(t));
      while ((t = t.getCause()) != null) {
        System.err.println("Caused by:");
        System.err.println(ThreadContext.createRawBacktraceStringFromThrowable(t));
      }
      System.exit(1);
    }
  }
예제 #2
0
파일: Main.java 프로젝트: ratnikov/jruby
  /**
   * This is the command-line entry point for JRuby, and should ONLY be used by Java when starting
   * up JRuby from a command-line. Use other mechanisms when embedding JRuby into another
   * application.
   *
   * @param args command-line args, provided by the JVM.
   */
  public static void main(String[] args) {
    doGCJCheck();

    Main main;

    if (DripMain.DRIP_RUNTIME != null) {
      main = new Main(DripMain.DRIP_CONFIG, true);
    } else {
      main = new Main(true);
    }

    try {
      Status status = main.run(args);
      if (status.isExit()) {
        System.exit(status.getStatus());
      }
    } catch (RaiseException rj) {
      System.exit(handleRaiseException(rj));
    } catch (Throwable t) {
      // print out as a nice Ruby backtrace
      System.err.println(ThreadContext.createRawBacktraceStringFromThrowable(t));
      while ((t = t.getCause()) != null) {
        System.err.println("Caused by:");
        System.err.println(ThreadContext.createRawBacktraceStringFromThrowable(t));
      }
      System.exit(1);
    }
  }