user201891
user201891

Reputation:

Where is my classpath being set?

Whenever I open a Bash shell, my classpath is "someProgram". I know that adding an export entry to ".bashrc" changes my classpath, but I want to know where "someProgram" is being added to the classpath (it's not in ".bashrc").

Is there a way to track down where this is being set, or some typical spots I should be checking besides ".bashrc"?

Details:

I'm using Ubuntu 9.10.

Eclipse Version: 3.5.1 is installed.

echo $SHELL
/bin/bash

java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.6.1) (6b16-1.6.1-3ubuntu1)
OpenJDK Server VM (build 14.0-b16, mixed mode)

javac -version
javac 1.6.0_15

More details if requested.

Checked:

Found!

/etc/environment

Upvotes: 0

Views: 1934

Answers (4)

wds
wds

Reputation: 32283

Ah yes, the whackamole process of finding which startup file is sourced where. I propose brute forcing it, try:

$ grep CLASSPATH .?*
$ grep -r CLASSPATH --binary-files=without-match /etc/ 2>/dev/null

Upvotes: 1

Stephen C
Stephen C

Reputation: 718796

Recheck all of those files to see if they source any other files using the "." builtin command.

Upvotes: 1

amit kumar
amit kumar

Reputation: 21022

The answer depends on where bash reads the profile from. A well-explained answer is here. An excerpt:


When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior. ... When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of /etc/bash.bashrc and ~/.bashrc.


Upvotes: 1

Geln Yang
Geln Yang

Reputation: 912

in the file /etc/profile.

Upvotes: 1

Related Questions