• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Passing runtime environment to child process on Solaris and citrix from java program

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an application that is supposed to launch an html page in netscape browser by executing a shell script.

So in my main code i am writing this:

String command = "start http:\\index.html"; //"start" is the shell script
Runtime.getRuntime().exec(command);

This code is working fine when i running it on Solaris but, the process doesn't launch through Citrix metaframe. It's searching for the user home in this case.

I suppose when a parent process launches a child process then the run time environment variables are also passed to the child. But in my case i am not getting the user home 'HOME' variable.

Is there any way by which i can pass the system environment variables manually to the child process in my java code?


Thanks
Puneet
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at the

version of exec. If you specify null for the envp and dir parameters it uses the calling processes environment and working directory.
[ June 08, 2006: Message edited by: Joanne Neal ]
 
Puneet Nayyar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Joanne!!!
A small doubt i have here. If in envp array I specify some variables that are application specific and not system variables i.e. envp is not null. In this case calling processes environment is not getting passed to called process implicitly. But if I pass the environment variables in envp then the child process is getting all the required environment variables.

Does this means that if envp contains some variables then the System environment is not passed implicitly?

Regards,
Puneet
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never used the method myself but that's what I would expect to happen having read the Javadoc.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're in a recent enough JDK, see ProcessBuilder, too. It's a friendlier way to build and run an exec() call.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic