File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes Export automatically... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Export automatically..." Watch "Export automatically..." New topic

Export automatically...

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 751
Hi, in windows XP, you could set the environment variable PATH to remember the java bin directory... In windows 98 or later, you could use the set path command... In Linux, we use the export command. But I don't want to do this everytime I start my computer. Any idea on how to get around this problem? I have heard of editing the profile but couldn't find the right sources to teach me how to do that... Thanks!

SCJP 1.5
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
You can put those kinds of definitions into your shell resource file. That's located in your home directory, and called something like ".tcshrc" (for the TCSH shell) or ".bashrc" (for the bash shell) or something similar. THose get executed automatically when a new shell starts.
If you put it into the ".profile" file (also in your home directory), it will be executed no matter what shell you use (if I remember correctly, haven't actaully tried that myself).
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Depending on your linux-flavour, different files might be appropriate.
To investigate, which file is used for your linux, you could search where the path is set so long:

Top-candidates are /etc/profile and /etc/bash.bashrc
For these system-wide configuration-files you need to be root to write to them.

with your favourite editor.

You don't need the 'export' if it is called later in the file.

If different users of the machine need different settings, the situation is more complicated.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

There's actually probably about 5 different places you can set profile info, depending on whether you want it known to a single user or all users, what shells you want affected, and so forth. It takes a little digging, but it's there.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Export automatically...
jQuery in Action, 3rd edition