LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to set a environment variable in rh? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-set-a-environment-variable-in-rh-46580/)

yenonn 02-21-2003 07:42 PM

How to set a environment variable in rh?
 
Dear all,

i want to set some environment variable to rh. then how?

Thanks in advance!

Cheers,
yenonn

Crashed_Again 02-21-2003 08:18 PM

You want to set some environmental variables in RedHat? Are you referring to a shell environment?

yenonn 02-21-2003 08:28 PM

i don't know what should it be.

in windows, i can set path, such as:

set PATH=d:\java\jdk1.4.0\bin;d:\ant\bin
set ANT_HOME=d:\ant
set JAVA_HOME=d:\java\jdk1.4.0

but, i am totally new to rh8, if i want to do something like this. then, how can i get it right?

Cheers,
yenonn

nakkaya 02-21-2003 08:35 PM

so you want to create a link right?
like file is located somewhere but you want to make it look like elsewhere did i get it right

cuckoopint 02-21-2003 08:36 PM

well, to check your path you can use:
$PATH

to edit your path:
export $PATH=/bin:/home/usr/bin:etc...
or
export $PATH=$PATH:/home/usr/bin (which adds the last entry to your original path).

Now for these others, I'm not sure what you're trying to do....you see, some program has to actually *use* these environments you'd be setting. You can just about export anything, but its pointless unless you use it. So, check the scripts to determine what variables are being used and work from there. Also, if you're making your own scripts, you dont need to export variables on the command line, but instead in the script.

maybe you could tell us the context that this came up under...

yenonn 02-21-2003 08:56 PM

ok, all i want to do is like this.
i want to setup a java environment for my linux redhat...
i have downloaded and installed the java standard development kit 1.4.0.0.1 from www.java.sun.com. then, i want to set some environment variables like JAVA_HOME,... and etc. to the system. (i did that in windows 98). so, does ur solution hits my need?
if so, thanks, else, what should be then?

yenonn 02-21-2003 09:11 PM

i think nakkaya is near to my thinking...

nakkaya 02-21-2003 09:17 PM

you have to create a sym link if you are using gnome and kde find the file you want to link and right click it then choose create link or some think like that i am not using both so i am not sure the name but i know there is a entry like that then drag and drop it where you want to link it

cuckoopint 02-21-2003 09:25 PM

ok,
1. If this is a program that you're running, you can create an alias in ~/.bashrc
something like:
alias cool_name=/boring/long/path/to/boring/name

2. But I think what you are doing is trying to change the default paths/or variables for already made scripts. See my earlier post: these names dont do much unless you know what they are exactly (for example your JAVA_HOME).
now, there are 2 ways:
you can try a
"export $JAVA_HOME=whatever this is supposed to be"

or try locating the oiginal/universal copy:
"grep JAVA_HOME /etc/"
then just edit the config file grep finds.

3. If there is no config file found, maybe variables like "JAVA_HOME" (again...I dont know how hava works) is set during install. then you'll ether have to go back to 2, or even more-so you may have to install from source, editing the make file before you compile.

cuckoopint 02-21-2003 09:35 PM

looking at your previous post:

Code:

set PATH=d:\java\jdk1.4.0\bin;d:\ant\bin
set ANT_HOME=d:\ant
set JAVA_HOME=d:\java\jdk1.4.0

my #1 or #2 looks like what you're looking for (assuming this is a program).

yenonn 02-21-2003 09:40 PM

thanks cuckoopint,
thanks... you have given me a clear picture...

Cheers,
yenonn

cuckoopint 02-21-2003 10:24 PM

glad to help and hope it works out.

*note to self: must take on java one of these days.


All times are GMT -5. The time now is 04:38 AM.