On Tue, 2004-02-24 at 13:56, arundeep singh wrote:
> Hello Arindam, 
> 
> thanx for the help. 
> i installed J2SDK1.4.2 but not the rpm version.
> well the problem got solved as what was happening is
> that i was setting the CLASSPATH in one shell(1) and
> compiling in other shell(2). but when i  compiled the
> same java file by changing to the directory in
> shell(1). then it worked without problem.
> 
> but still there is a question, as if above is the case
> then it means when we setup a variable in one shell it
> doesn't come in effect in global environment and
> doesn't show any change in other shells.  but when u
> close all the shells and reopen them then it works in
> all the shells. why is that and what is the remedy.


First off Kindly DO NOT top post. To see what is top posting go here

http://rfc.net/rfc1855.html

Secondly could you kindly trim your replies to remove all the unwanted
stuff from it left at the bottom. 

Both of the above are just mailing list netiquette. I am pretty sure
quite a few of the others here would be thankful if you do follow them
and maybe more people will be inclined to reply to your posts.

Now finally to your question ...

How did you export the variable CLASSPATH in the shell where it *is*
compiling ? If you did it by hand like as in "export
CLASSPATH="/some/absolute/path:/some/other/path:/etc/etc"" then that
variable is exported for only the session at the prompt you have
exported it in. It is not for the whole X session you have logged in.
And opening and closing a "Konsole" for KDE and "gnome-terminal" for
GNOME is *NOT* the same as logging out and logging in at a terminal
console.(Ctrl-Alt-F[1-*]).

The only sure way of exporting system wide for all users is to either
use the /etc/profile file or a more elegant method would be to use
/etc/profile.d/ directory. Create a file here called say jdk.sh and put
in something like this in it

#!/bin/bash
 
CLASSPATH=/usr/j2sdk1.4.2_02/lib:/usr/j2sdk1.4.2_02/lib/tools.jar
:/usr/j2sdk1.4.2_02/lib/dt.jar:/usr/j2sdk1.4.2_02/jre/lib/rt.jar:
/usr/j2sdk1.4.2_02/lib/mail.jar:/usr/j2sdk1.4.2_02/lib/activation.
jar:/usr/j2sdk1.4.2_02/jre/lib/i18n.jar:/usr/j2sdk1.4.2_02/jre/lib
/javaplugin.jar:/usr/j2sdk1.4.2_02/jre/lib/sunrsasign.jar
 
PATH="$PATH:/usr/j2sdk1.4.2_02/bin"
 
export PATH CLASSPATH

and make that executable (chmod +x /etc/profile.d/jdk.sh). You will need
root access to do this system wide.

Still if you want to do it individually the only option that I can think
off now

put the "export CLASSPATH=/path/whatever/you/want/here" in the file
.bashrc(note the dot before filename) and source the file. You will find
this file in your home directory. Like this "source /path/to/.bashrc".
This is the same as exporting it manually in all the open shells the
only advantage of this is that any subsequent new shells that you open
using konsole or gnome-terminal will already have this variable in it
while the manual export you will have to do it again. You will still
need to go and source the .bashrc in any already open "konsoles or
gnome-terminals" and yes this also includes already open tabs in
gnome-terminal or shells under the same konsole. You have to do it
again.

Regards,

-- 
Arindam Dey

The mind is not a vessel to be 
filled but a fire to be kindled.

GPG FPR: B8E3 219E F129 F970 F4A7  BC50 9636 504A BEDF 5739


_______________________________________________
ilugd mailinglist -- [EMAIL PROTECTED]
http://frodo.hserus.net/mailman/listinfo/ilugd
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/[EMAIL PROTECTED]/

Reply via email to