Switching hosts and paths

Hi all,

Currently I work with two different hosts, one linux and one hp unix but with two separate versions of java installed (for a reason). The problem is: within the PATH there is already a /bin/java version installed i.e. when I do a printenv PATH it lists it as you'd expect. When I use host1 lets say this is fine, but when I do a ssh host2 -X command, it still inherits the same path. Therefore, even if I add this other path within my .kshrc file, it still inherits the other. How do I make sure the correct java path is inherited when I switch between two different hosts?

Thanks

CF

How do you add it ot your PATH in .kshrc?
export PATH=$PATH:/... or export PATH=<javapath>:$PATH ?

---------- Post updated at 17:15 ---------- Previous update was at 17:11 ----------

Anyway on HPUX I am responsible, I set no java PATH, letting the user, having to set in his .profile depending on the version he needs:

ant:/home/vbe/script $ ll /opt/java
total 458392
drwxr-xr-x   4 bin        bin             96 Feb 14  2007 java1.2
dr-xr-xr-x   8 bin        bin           1024 May 10  2004 java1.4
drwxr-xr-x   9 bin        bin           1024 Mar 10  2005 java1.5

I use:
export PATH=$PATH:/bin/java/bin: but it doesn't seem to overwrite what has already been set but at the same time this is only useful in getting one version working....

That is because you have in $PATH already somewhere a java...
use export PATH=/bin/java/bin:$PATH

Cool thats worked but it has now just overitten what was already set in the PATH environment, to a differnt version but I still seem to be in the same problem with what I version is accessible, apart from just having two PATH lines to point to diferent versions of Java by commenting one out, is there another way of doing this?

As I already mentionned, the best would be to remove java form PATH, and set individually in .profile or .kshrc as needed, I do this for all software binaries when I have multiple versions...
one alternative is to create source files e.g. java_profile1 java_profile2 etc..
I do this when a software requires it version binaries plus environment VAR to be set as special java path etc... like SAS8 used (java 1.0.X and) netscape, SAS9 uses java 1.2 but also java1.4 and mozilla...
then when you need a profile, just source: . ./the_chosen_profile

okay I get what you're saying, cheers for your help there