Java Runtime class; exec method HELP!
Java Runtime class; exec method HELP!
- Subject: Java Runtime class; exec method HELP!
- From: Melissa Kimball <email@hidden>
- Date: Wed, 11 Feb 2004 13:14:57 -0500
Within my WebObjects application I am using the Java Runtime class to make a
command-line call on one of our Apple Xserves. One of our Xserves is a
webserver that runs my WO application. Since these request are coming in
from the web, darwin (UNIX) can only give full access to certain directories
- fine, but.....I need to have certain environment variables set while
executing my command-line binary call. This command-line call is not a
system call, but a call to 3rd party software (sun9s grid engine), which
needs specific environment variables set to operate properly.
So far my ideas are to set these environment variables in the .cshrc or
.login file for the www account - I don9t think this will fly to well with
our system administrator!
Then in the Runtime class api documentation it states that you can send over
an array of Strings with the format name=value to set environment variables
for your newly threaded process. I9m thinking the format is something like
HOME=/Users/me???? I can9t find any examples any where, and I9ve tried
different combinations to try to get it to work, and I can9t! I9m
especially having a hard time with how to set the
PATH=$PATH:/my/new/bin?????
I9ve attached the api docs for this method below:
> exec
> public Process exec(String command,
> String[] envp,
> File dir)
> throws IOException
> Executes the specified string command in a separate process with the
specified
> environment and working directory.
>
> This method breaks the command string into tokens and creates a new array
> cmdarray containing the tokens in the order that they were produced by the
> string tokenizer; it then performs the call exec(cmdarray, envp). The token
> parsing is done by a StringTokenizer created by the call:
> new StringTokenizer(command)
>
> with no further modification of the character categories.
>
> The environment variable settings are specified by envp. If envp is null,
the
> subprocess inherits the environment settings of the current process.
>
> The working directory of the new subprocess is specified by dir. If dir is
> null, the subprocess inherits the current working directory of the current
> process.
> Parameters:
> command - a specified system command.
> envp - array of strings, each element of which has environment variable
> settings in format name=value.
> dir - the working directory of the subprocess, or null if the subprocess
> should inherit the working directory of the current process.
> Returns:
> a Process object for managing the subprocess.
Thank you in advance for all your help. If anyone does have any suggestions
or answers, could you please reply to my email@hidden account as
well as the list serv. I9m not a part of either the java-dev or
webobjects-dev list serves right now because I9m overwhelmed with all the
list servs I9ve already got going (I9m sure a lot of you could relate).
--
Melissa Kimball
UNC-Chapel Hill
Giddings Lab
919.843.3389
email@hidden
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.