mxj object heaven (not...)


    Mar 20 2011 | 9:32 pm
    Hello,
    I wonder if anyone has had trouble with the mxj object..
    I've just built a java external invoking it with mxj that
    1. calls an executable.
    2. reads its output and prints it.
    I've implemented the above logic in the bang method:
    public void bang()
    {
    try
    {
    // launch EXE and grab stdin/stdout and stderr
    Process process = Runtime.getRuntime ().exec ("F:/test.exe");
    InputStream is = process.getInputStream();
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    while ((line = br.readLine()) != null)
    {
    System.out.println(line);
    }
    }
    catch (Exception err)
    {
    err.printStackTrace();
    }
    }
    When i send a bang to that external, the patch launches the test.exe process but subsequently freezes (windows vista, maxforlive 5.1.7)
    and prints the output when I kill the process with process explorer.
    I tried to execute the same code in a java program and there it run successfully.
    Does anyone know of issues with the mentioned readline methods in max/msp?
    Any hints would be greatly appreciated.
    warm regards

    • Mar 20 2011 | 9:50 pm
      Without knowing what your external process is it's hard to say, but have you tried spawning a new Thread and executing the code there?
    • Mar 21 2011 | 11:43 am
      That did the trick! Many many thanks for pointing this out !