<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -28,6 +28,7 @@ import org.mozilla.javascript.RhinoException;
 
 import static java.lang.System.err;
 import static java.lang.System.out;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Formatter;
@@ -127,12 +128,13 @@ public class HelmaRunner {
             }
             if ((scriptName == null &amp;&amp; expr == null)  || runShell) {
                 // autodetect --silent option if stdin or stdout is redirected
-                // only works on Java 6 or later
                 if (!silent) {
+                    // System.console() is only available on Java 6 or later
                     try {
-                        silent = System.console() == null;
-                    } catch (NoSuchMethodError nsm) {
-                        // System.console() isn't available before Java 6
+                        Method systemConsole = System.class.getMethod(&quot;console&quot;);
+                        silent = systemConsole.invoke(null) == null;
+                    } catch (NoSuchMethodException nsm) {
+                        // System.console() not available
                     }
                 }
                 new HelmaShell(config, engine, history, verbose, silent).run();</diff>
      <filename>src/org/helma/tools/HelmaRunner.java</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>860bff5490df78c4fc859170e24f1c876a62ff16</id>
    </parent>
  </parents>
  <author>
    <name>Hannes Walln&#246;fer</name>
    <email>hannesw@gmail.com</email>
  </author>
  <url>http://github.com/hns/helma-ng/commit/f2b63a0c318109bcbea4ab78cf67b0c1f492231a</url>
  <id>f2b63a0c318109bcbea4ab78cf67b0c1f492231a</id>
  <committed-date>2009-11-05T00:24:19-08:00</committed-date>
  <authored-date>2009-11-05T00:24:19-08:00</authored-date>
  <message>Fix for java.lang.System.console() not available on Java versions &lt;= 5</message>
  <tree>5208669e4f909afff590e56f4f5d3a7c88720e1f</tree>
  <committer>
    <name>Hannes Walln&#246;fer</name>
    <email>hannesw@gmail.com</email>
  </committer>
</commit>
