//I am encountering my Netbeans 9 console capture problem via the following:

package Project;

import java.util.LinkedList;
import static java.lang.System.out;

public class Main
{
 public static void main(String ... args)
 {
  out.println();

  out.println("Primary Main program has begun.");

  out.println();

  //Designed to intentionally fill up memory.
  LinkedList<Object> list = new LinkedList<Object>();

  while(true)
  {
  list.add(new Object());
  }
 }

}//End of Class

package Project;

import java.io.InputStreamReader;
import java.io.BufferedReader;
import static java.lang.System.out;

public class Launcher
{
   public static void main(String ... args)
   {
     try
     {
     //This is not a blocking command.
     ProcessBuilder builder = new ProcessBuilder("java", "-Xmx8192m", "-cp", 
"MemoryLauncher.jar", "Project.Main");

     builder.inheritIO();

     Process process = builder.start();

     BufferedReader reader = new BufferedReader(new 
InputStreamReader(process.getInputStream()));

     String line;

     out.println();

      do
     {
     line = reader.readLine();

      if(line instanceof String)
       {
        out.println(line);
       }

     }
     while(line instanceof String);

     reader.close();

     }
     catch (Exception exception)
     {
     exception.printStackTrace();
     }
     out.println("Launcher program has finished.");

     out.println();

   }  //End of Main.
} //End of Class.

Reply via email to