Read System.out.println From Java Using popen ?
Rune Hansen
rune.hansen at mac.com
Thu Jun 16 02:55:28 EDT 2005
Your Friend wrote:
> result = os.popen( "%s/bin/java com.foo.service.JavaService %s" % (
> JAVA_HOME, FILE_TO_CREATE ) )
>
> print
> result.readlines()
>
I find that subprocess.Popen works _better_ for this kind of thing.
import os
from subprocess import Popen
outfile = open("out.txt","w")
errfile = open("err.txt","w")
pid = Popen([os.environ["JAVA_HOME"]+/bin/java,
"-classpath",
".",
"MyJavaExecutable"],
stdout=outfile,
stderr=errfile)
.
.
/rune
More information about the Python-list
mailing list