Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Runtime.exec gives problem in unix environment

Reply
Thread Tools

Runtime.exec gives problem in unix environment

 
 
Priyanka AGARWAL
Guest
Posts: n/a
 
      06-28-2004
Hi,
I have a problem with Runtime.exec() call.

I have used the following code:
String[] env = null;
Process wait = Runtime.getRuntime.exec(exeCmd , env ,workingDir);
.................
.................
My exe command uses some external application which has environment
settings.
If I give the env as null it takes the default environment settings
in windows and works fine in windows .But it doesnt work in UNIX,
it doesnt take the default environment settings in unix.
I have tried using String[] env = {""} , still it doesnt work in unix.

I want my code to work both on windows and unix.

Is there a solution???
Priyanka
 
Reply With Quote
 
 
 
 
=?UTF-8?B?IkRhcmlvIChkcmlua2luZyBjb++sgGVlIGluIHRoZSBv76yDY2XigKYpIg==?=
Guest
Posts: n/a
 
      06-28-2004
Priyanka AGARWAL wrote:

> Hi,
> I have a problem with Runtime.exec() call.
>
> I have used the following code:
> String[] env = null;
> Process wait = Runtime.getRuntime.exec(exeCmd , env ,workingDir);
> .................
> .................
> My exe command uses some external application which has environment
> settings.
> If I give the env as null it takes the default environment settings
> in windows and works fine in windows .But it doesnt work in UNIX,
> it doesnt take the default environment settings in unix.


Specification said:

The environment variable settings are specified by envp.
If envp is null, the subprocess inherits the environment
settings of the current process.

So when your env is null the subprocess does NOT take
a default environment settings, BUT it inherits the environment
settings of the current Java process.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there an environment variable that gives me line number and file? Xeno Campanoli / Eskimo North and Gmail Ruby 2 06-18-2010 09:50 PM
70-284 Lab Environment, Need Virtual Environment brooklynbridge508@hotmail.com MCSA 4 05-02-2007 09:49 AM
Setting an environment variable from another environment variable marcwentink@hotmail.com Java 5 04-04-2007 10:39 PM
how i can print the values of argv[] under unix environment.Plz help me Vinu C Programming 13 05-05-2005 09:10 AM
What is the equivalent of DLL in a Unix environment?? Alan C Programming 4 03-07-2004 10:04 PM



Advertisments