This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes Editing Environment Variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Editing Environment Variables" Watch "Editing Environment Variables" New topic

Editing Environment Variables

Brian Smith
Ranch Hand

Joined: Oct 26, 2002
Posts: 232
Hi Folks,
I am new to Linux world. When i type env, it shows bunch of environment variables and some of them are not what i would like. somehow i messed up those variables' values but i don't know which file i should open to get an access to those variables and edit those values. could you please help with this? thanks.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

A lot of files might be responsible.
Because linux is a networking system, there are setup-files for the whole system, as well as per user.

The system-specific ones are normally in /etc/XY[rc] - the user specific files in /home/carn/.XY[rc]
Not all files end on ...rc especially /etc/profile and /home/carn/.bashprofile.

If you search for the env-setting LC_TIME, I would use grep or find:
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17018

Careful, you could make the whole OS break down. Unless it's already been corrupted, you probably should be content with overriding them as needed. For example, say I want to work with Java 5, but everyone else is still on JDK 1.4, so I want to override the path and JAVA_HOME (or on my servers, add them, since they're not standard OS settings). The best place for me to do than on a RedHat/Fedora system is in /home/timh/.bash_profile. Just set and export JAVA_HOME and update exported PATH=$JAVA_HOME/bin:$PATH.

How environment variables get set is largely a matter of where you are and how that particular distro manages that part of the system. The only real way to tell - unless there's documentation for your distro - is to manually trace the process. Certain key files are /etc/profile, /etc/skel (where prototype profiles for newly added users are defined), and the $HOME profile file(s) used for the shell you're running. For their names, consult the man pages for your shell of choice.

Customer surveys are for companies who didn't pay proper attention to begin with.
Have you checked out Aspose?
subject: Editing Environment Variables
jQuery in Action, 3rd edition