コード例 #1
0
ファイル: Main.java プロジェクト: rebx/jruby
 private Status handleUnsupportedClassVersion(UnsupportedClassVersionError ucve) {
   config
       .getError()
       .println("Error: Some library (perhaps JRuby) was built with a later JVM version.");
   config
       .getError()
       .println(
           "Please use libraries built with the version you intend to use or an earlier one.");
   if (config.isVerbose()) {
     config.getError().println("Exception trace follows:");
     ucve.printStackTrace();
   } else {
     config.getError().println("Specify -w for full UnsupportedClassVersionError stack trace");
   }
   return new Status(1);
 }
コード例 #2
0
  public static void main(String[] args) throws Exception {
    try {
      String v = System.getProperty("java.class.version");
      if (v != null) {
        try {
          if (Float.parseFloat(v) < 51.0f) throw new UnsupportedClassVersionError(v);
        } catch (NumberFormatException e) {
          // err on the safe side and keep on going
        }
      }

      ColorFormatter.install();

      _main(args);
    } catch (UnsupportedClassVersionError e) {
      System.err.println(
          "Jenkins requires Java7 or later, but you are running "
              + System.getProperty("java.runtime.version")
              + " from "
              + System.getProperty("java.home"));
      e.printStackTrace();
    }
  }
コード例 #3
0
ファイル: Main.java プロジェクト: aslakhellesoy/jruby
  public int run(String[] args) {
    try {
      config.processArguments(args);
      return run();
    } catch (MainExitException mee) {
      if (!mee.isAborted()) {
        config.getOutput().println(mee.getMessage());
        if (mee.isUsageError()) {
          printUsage();
        }
      }
      return mee.getStatus();
    } catch (OutOfMemoryError oome) {
      // produce a nicer error since Rubyists aren't used to seeing this
      System.gc();

      String memoryMax = SafePropertyAccessor.getProperty("jruby.memory.max");
      String message = "";
      if (memoryMax != null) {
        message = " of " + memoryMax;
      }
      config
          .getError()
          .println("Error: Your application used more memory than the safety cap" + message + ".");
      config.getError().println("Specify -J-Xmx####m to increase it (#### = cap size in MB).");

      if (config.getVerbose()) {
        config.getError().println("Exception trace follows:");
        oome.printStackTrace();
      } else {
        config.getError().println("Specify -w for full OutOfMemoryError stack trace");
      }
      return 1;
    } catch (StackOverflowError soe) {
      // produce a nicer error since Rubyists aren't used to seeing this
      System.gc();

      String stackMax = SafePropertyAccessor.getProperty("jruby.stack.max");
      String message = "";
      if (stackMax != null) {
        message = " of " + stackMax;
      }
      config
          .getError()
          .println(
              "Error: Your application used more stack memory than the safety cap" + message + ".");
      config.getError().println("Specify -J-Xss####k to increase it (#### = cap size in KB).");

      if (config.getVerbose()) {
        config.getError().println("Exception trace follows:");
        soe.printStackTrace();
      } else {
        config.getError().println("Specify -w for full StackOverflowError stack trace");
      }
      return 1;
    } catch (UnsupportedClassVersionError ucve) {
      config
          .getError()
          .println("Error: Some library (perhaps JRuby) was built with a later JVM version.");
      config
          .getError()
          .println(
              "Please use libraries built with the version you intend to use or an earlier one.");

      if (config.getVerbose()) {
        config.getError().println("Exception trace follows:");
        ucve.printStackTrace();
      } else {
        config.getError().println("Specify -w for full UnsupportedClassVersionError stack trace");
      }
      return 1;
    } catch (ThreadKill kill) {
      return 0;
    }
  }