setting PATH variable and linux

I am trying to set the PATH variable. I issue the following command PATH=$PATH/usr/java/j2sdk1.4.2/bin export PATH The PATH is then set but if I close down the terminal window the changes are gone. Please help as I have almost reached breakiing point david

Note that this is not a Java question at all; this probably belongs in "General Computing." Anyway, you have to put the shell commands you're showing us into a file that is executed when your shell starts. Precisely -which- file to use depends on which shell you're using, and also to a lesser extent on the details of how your system is set up. Your best bet is to put those lines into a file in your home directory named .bashrc (note that the name starts with a period, making it an "invisible" file.)

Hi David, Some options for you: Edit the file <code>.bash_profile</code> (note the leading period) in your home directory. Put your path statment into there. Whenever you log in, this file is executed, and so the path should be set. (If you are using a different shell than bash, ask and someone can tell you the apropriate profile). Alternatively, if this is something that all users are likely to want in their environment, then you could ask the administrator to add a file to the <code>/etc/profile.d/</code> directory. I have one in there called java.sh containing:<code><pre> export JAVA_HOME=/usr/java/j2sdk1.4.0_01 export ANT_HOME=/opt/jakarta-ant-1.4.1 export PATH=${PATH}:${JAVA_HOME}/bin:${ANT_HOME}/bin: </pre></code> This gets executed for all users, and sets the environment correctly for them all. Regards, Andrew