Ralph Scheuer wrtoe:
> Process process = Runtime.getRuntime().exec(invocationString);
If invocationString is a String, rather than a String[], then embedded
spaces in pathnames or other command-line args will not be parsed properly.
Use the String[] form of exec() instead.
> process.getInputStream().read(myBytes);
If the exec()'ed command's output is longer than myBytes, then some output
won't be collected. If its output is shorter than myBytes, then you won't
know how many bytes in the array are valid, because you're not using the
count returned by read().
> results = new String (myBytes);
That form of the String constructor uses the default text-encoding, which
is "MacRoman" by default on Mac OS X. The output of most Unix commands, on
the other hand, is UTF-8. If myBytes contains any bytes outside the range
0x00-0x7F, they will be mistranslated in conversion to a String.
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden