Package org.jruby

Class Main

java.lang.Object
org.jruby.Main

public class Main extends Object
Class used to launch the interpreter. This is the main class as defined in the jruby.mf manifest. It is very basic and does not support yet the same array of switches as the C interpreter. Usage: java -jar jruby.jar [switches] [rubyfile.rb] [arguments] -e 'command' one line of script. Several -e's allowed. Omit [programfile]
  • Field Details

  • Constructor Details

  • Method Details

    • getDotfileDirectories

      private static List<String> getDotfileDirectories()
    • processDotfile

      public static void processDotfile()
    • loadJRubyProperties

      private static void loadJRubyProperties(File dotfile)
    • main

      public static void main(String[] args)
      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.
      Parameters:
      args - command-line args, provided by the JVM.
    • run

      public Main.Status run(String[] args)
    • run

      @Deprecated public Main.Status run()
      Deprecated.
    • internalRun

      private Main.Status internalRun()
    • handleUnsupportedClassVersion

      private Main.Status handleUnsupportedClassVersion(UnsupportedClassVersionError ex)
    • handleStackOverflow

      private Main.Status handleStackOverflow(StackOverflowError ex)
      Print a nicer stack size error since Rubyists aren't used to seeing this.
    • handleOutOfMemory

      private Main.Status handleOutOfMemory(OutOfMemoryError ex)
      Print a nicer memory error since Rubyists aren't used to seeing this.
    • getRuntimeFlagValue

      private String getRuntimeFlagValue(String prefix)
    • handleMainExit

      private Main.Status handleMainExit(MainExitException mee)
    • doRunFromMain

      private void doRunFromMain(Ruby runtime, InputStream in, String filename)
    • doCheckSyntax

      private Main.Status doCheckSyntax(Ruby runtime, InputStream in, String filename) throws RaiseException
      Throws:
      RaiseException
    • checkFileSyntax

      private boolean checkFileSyntax(Ruby runtime, String filename)
    • checkStreamSyntax

      private boolean checkStreamSyntax(Ruby runtime, InputStream in, String filename)
    • doSetContextClassLoader

      private void doSetContextClassLoader(Ruby runtime)
    • doPrintProperties

      private void doPrintProperties()
    • doPrintUsage

      private void doPrintUsage(boolean force)
    • doShowCopyright

      private void doShowCopyright()
    • doShowVersion

      private void doShowVersion()
    • doGCJCheck

      private static void doGCJCheck()
    • doCheckSecurityManager

      private void doCheckSecurityManager()
    • handleRaiseException

      protected static int handleRaiseException(RaiseException ex)
      This is only used from the main(String[]) path, in which case the err for this run should be System.err. In order to avoid the Ruby err being closed and unable to write, we use System.err unconditionally.
      Parameters:
      ex -
      Returns:
    • handleUnexpectedJump

      private static int handleUnexpectedJump(JumpException ex)