You are not logged in.

#1 2008-06-16 21:48:50

da-man9191
Member
Registered: 2008-06-12
Posts: 7

Enviroment Variables

Is there any such thing as environment variables in Linux? I have Java's JDK and JRE downloaded and installed in folders... Now I need my environment variables to point to them.

Offline

#2 2008-06-16 22:02:54

mmmasterluke
Member
Registered: 2007-12-07
Posts: 49

Re: Enviroment Variables

Type

env

to see all environment variables. In bash, you can set new ones with

export VARIABLE=value

.

Hope that helps...

Last edited by mmmasterluke (2008-06-16 22:03:12)

Offline

#3 2008-06-17 08:55:30

Davigetto
Member
From: In your mind
Registered: 2007-05-10
Posts: 266

Re: Enviroment Variables

If you want to define the classpath:

export CLASSPATH=.:/path/to/your/classes:/another/path

unlike windows, path separators are colons, not semicolons wink


Only deaths can see the end of battles.

Blog: http://djmartinez.co.cc -> The life of a Computer Engineer

Offline

#4 2008-06-17 09:49:50

eWoud
Member
Registered: 2005-07-06
Posts: 39

Re: Enviroment Variables

It's usually better to add things to CLASSPATH or PATH, instead of overwriting them, as this may cause other applications to break.

For example:

export CLASSPATH=$CLASSPATH:/your/new/path/here

tea is overrated

Offline

#5 2008-06-17 17:58:17

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: Enviroment Variables

you can set these variables in your ~/.bashrc (or ~/.${shell}rc, if you're fancy) to have them be defined whenever you fire up a terminal, in particular on boot.

Offline

#6 2008-06-17 18:21:52

Zepp
Member
From: Ontario, Canada
Registered: 2006-03-25
Posts: 334
Website

Re: Enviroment Variables

System wide changes can be done in /etc/profile.

Offline

#7 2008-06-17 20:13:19

da-man9191
Member
Registered: 2008-06-12
Posts: 7

Re: Enviroment Variables

If I add

export PATH='$PATH:~/jre1.6.0_06/bin'

to my file '~/.bashrc' would that work?

Last edited by da-man9191 (2008-06-17 20:14:58)

Offline

#8 2008-06-17 20:32:30

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: Enviroment Variables

yes, but only for your account.

You could also place a script or soft link pointing to them in /usr/bin, /usr/local/bin or anywhere else that PATH is already pointing to.  This would keep things much simpler, in my opinion.

Offline

#9 2008-06-17 20:33:19

ThomasAdam
Member
From: Southampton, England
Registered: 2005-10-26
Posts: 148

Re: Enviroment Variables

da-man9191 wrote:

If I add

export PATH='$PATH:~/jre1.6.0_06/bin'

to my file '~/.bashrc' would that work?

If you replace the single quotes with double quotes, then yes.

-- Thomas Adam

Offline

Board footer

Powered by FluxBB