Note that there are some explanatory texts on larger screens.

plurals
  1. PORuntime.exec() no output
    primarykey
    data
    text
    <p>Code that runs 4 'Street' processes:</p> <pre><code>for (int i=0; i &lt; NUM_STREETS; i++) { Process process = runtime.exec("java -classpath \\bin trafficcircle.Street 1 2"); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null &amp;&amp; !line.isEmpty()) { System.out.println(line); System.out.flush(); } InputStream es = process.getErrorStream(); InputStreamReader esr = new InputStreamReader(es); BufferedReader br2 = new BufferedReader(esr); while ((line = br2.readLine()) != null &amp;&amp; !line.isEmpty()) { System.out.println(line); System.out.flush(); } int exitVal = process.waitFor(); System.out.println("Process exitValue: " + exitVal); } </code></pre> <p>Where 'Street' is:</p> <pre><code>public class Street { /** * @param args * 0 - Simulation run time * 1 - Flow time interval */ public static void main(String[] args) { System.out.println(args[0]); System.out.println(args[1]); System.out.flush(); } </code></pre> <p>}</p> <p>Prints out:</p> <pre><code>Error: Could not find or load main class trafficcircle.Street Process exitValue: 1 Error: Could not find or load main class trafficcircle.Street Process exitValue: 1 Error: Could not find or load main class trafficcircle.Street Process exitValue: 1 Error: Could not find or load main class trafficcircle.Street Process exitValue: 1 </code></pre> <p>'Street.class' in my Eclipse project is under \bin in package trafficcircle. I thought Runtime.exec would complain first if it wasn't found...what's up with this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload