Run python within Java - Mac OS X

Hi,

I would like to know if it is possible to start a python program using the

Process p = Runtime.getRuntime().exec(cmd)

command running on Mac OS X 10.4.2. I have tried

String [] cmd = new String [] {"open", "-a", "python ", "pythonProg.py"};

Am i on the right track?

Thanks in advance,

Jimmy

[347 byte] By [Jimmy0676a] at [2007-10-2 5:15:25]
# 1
> Am i on the right track? Seems so. But make sure you read this before you proceed further: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
annie79a at 2007-7-16 1:17:51 > top of Java-index,Administration Tools,Sun Connection...
# 2

Hi,

I tried writing a simple c++ program and also trying commands such as "ls", "pwd" but nothing seems to work!

This is an error I have encountered.

James

java.io.IOException: /Users/jimmy/Desktop/aviation/inputData/exampleScripts/./a.out: not found

at java.lang.UNIXProcess.forkAndExec(Native Method)

at java.lang.UNIXProcess.<init>(UNIXProcess.java:54)

at java.lang.Runtime.execInternal(Native Method)

at java.lang.Runtime.exec(Runtime.java:566)

at java.lang.Runtime.exec(Runtime.java:428)

at java.lang.Runtime.exec(Runtime.java:364)

at java.lang.Runtime.exec(Runtime.java:326)

at Temp.<init>(Temp.java:30)

at Temp.main(Temp.java:42)

Jimmy0676a at 2007-7-16 1:17:51 > top of Java-index,Administration Tools,Sun Connection...
# 3
Not easy without any details. What does this yield?ls -l /Users/jimmy/Desktop/aviation/inputData/exampleScripts/./a.out
BIJ001a at 2007-7-16 1:17:51 > top of Java-index,Administration Tools,Sun Connection...
# 4
You might also want to look into Jython, a Java-friendly version.
ChuckBinga at 2007-7-16 1:17:51 > top of Java-index,Administration Tools,Sun Connection...