Re: java command containing classpath in quotes on unix

From: Sudsy (bitbucket44_at_hotmail.com)
Date: 01/05/04


Date: Mon, 05 Jan 2004 12:59:21 -0500

Nishi Bhonsle wrote:
<snip>
> tcsh.
> Looks like I need to use Korn shell to run the java command successfully(I just changed the shell to ksh and it worked fine). But since I am spawning this command inside another program say A.java I will have to explicitly set the shell before running A.java. Hopefully the command can see the shell settings.
> Is there any other way around besides changing the shell?
> Thanks.

Try something like this:

Process p = Runtime.getRuntime().exec(
   new String[] { "/bin/ksh", ... } );

where your other arguments replace the elipses.
Here's an example:

Process p = Runtime.getRuntime().exec( new String[] { "/bin/ksh", "-c",
   "echo hello" } );

Then you have to get the stdout and stderr InputStreams, etc.
If you're unfamiliar with that part then post again.



Relevant Pages