Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4238356

System.setOut still does not work with JIT enabled

XMLWordPrintable



      Name: tb29552 Date: 05/14/99


      I'm using jdk 1.1.7B
      and according to your bug reports the problem with regards to
      "using System.setOut doesn't do anything with jit enabled" was fixed in 1.1.6
      I still have this problem in 1.1.7B

      symptoms are exactly the same, with -nojit it works
      as per the problem description.

      --------------------------------------------------
      out put from command line
      --------------------------------------------------
      D:\tmp\foo>java -fullversion
      java full version "JDK1.1.7U"

      D:\tmp\foo>java -classpath %classpath%;. foo
      type something
      Enter ('q') for quit :
      q
      this should go to a file

      D:\tmp\foo>java -nojit -classpath %classpath%;. foo
      type something
      Enter ('q') for quit :
      q

      --------------------------------------------------------
      source code (foo.java)
      --------------------------------------------------------
      import java.io.*;

      public class foo
      {
      public static void main(String argv[])
      {
      try
      {
      PrintStream p=new PrintStream(new FileOutputStream("foo.out", false));

      System.out.println("type something");

      String input;
      BufferedReader my_bf=new BufferedReader(new InputStreamReader(System.in));

      /*1*/ do
      /*2*/ {
      System.out.println("Enter ('q') for quit : ");

      input=my_bf.readLine();

      p.println(input);

      /*3*/ }
      /*4*/ while (!input.equals("q"));



      p.println("test");

      System.setOut(p);

      System.out.println("this should go to a file");

      }
      catch (Throwable t)
      {
      t.printStackTrace();
      }
      }
      }
      ------------------------------------------------

      Please take note of lines marked /*1*/ through /*4*/
      if you comment out those lines the program will work as
      expected.
      (Review ID: 54822)
      ======================================================================

            Unassigned Unassigned
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: