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

Program result is not displayed

    XMLWordPrintable

Details

    • 1.2beta4
    • sparc
    • solaris_2.6
    • Not verified

    Description

      Run the following programs.
      Specify another java program's name and arguments as java command arguments,
      but specified java program result is not displayed.
      reference : JDK 1.2 beta3-N : It works correctly.

      - compile ArgPass.java
      - compile Hello.java
      - run this program as follows:
      java ArgPass java Hello

      result : JDK 1.2 beta4-A
      Nothing.
      JDK 1.2 beta3-N
      "Hello World" displayed.

      programs:
      --------------------
      import java.io.*;

      public class ArgPass implements Runnable {
        InputStream is;
        OutputStream os;

        public static void main(String args[]) throws InterruptedException, IOException {
          Process ps = Runtime.getRuntime().exec(args);


          Thread tout = new Thread(new ArgPass(ps.getInputStream(), System.out));
          Thread terr = new Thread(new ArgPass(ps.getErrorStream(), System.err));
          tout.start();
          terr.start();
          tout.join();
          terr.join();

        }

        ArgPass(InputStream is, OutputStream os) {
          this.is = is;
          this.os = os;
        }

        public void run() {
          try {
            int ch;

            while((ch = is.read()) != -1)
              os.write(ch);
          } catch(IOException e) {
          }
        }
      }
      --------------------
      public class Hello {
      public static void main(String args[]) {
      System.out.println("Hello World");
      }
      }
      --------------------

      Attachments

        Activity

          People

            never Tom Rodriguez
            eishidasunw Etsuko Ishida (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: