From: Rick DeNatale Date: 2007-06-11T05:22:39+09:00 Subject: Re: using ` and the bash source command On 6/9/07, Kevin Jackson wrote: > So my code essentially builds a menu of all the different jdks > installed and then when the user picks an option (eg java-gcj), the > code writes the correct JAVA_HOME out to .bash_profile ready for use > > The final step was to source the .bash_profile so that I can just > choose a jdk and be immediately ready to use it > > Attached the code (it's not OO at all, just a simple script): ... I'm afraid that this approach won't work no matter what language you try to do it with. It's inherent with the nature of environment variables. When you run your little gui program, it gets a copy of the parent process's (i.e the bash shell) environment values. Any changes will only affect the environment of this child process and child processes it subsequently starts. If you were to run your Java program itself from ruby, I would think that you could set the JAVA_HOME environment variable directly with ENV[JAVA_HOME] = whatever you want, before executing Java as a child process of the Ruby program. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/