mxj object heaven (not…)

Mar 20, 2011 at 9:32pm

mxj object heaven (not…)

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

#55700
Mar 20, 2011 at 9:50pm

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?

#200292
Mar 21, 2011 at 11:43am

That did the trick! Many many thanks for pointing this out !

#200293

You must be logged in to reply to this topic.