Help - Search - Members - Calendar
Full Version: My system can't find Java tools
Linuxhelp > Support > Technical Support
I installed Java SDK 1.4.2_07 a year or so ago on my Linux system in;

there is a file named
the contents of this file are as follows;
export PATH=$PATH:/usr/java/j2sdk1.4.2_07/bin/

I believe this script is supposed to execute at login and allow Java tools to be used from any directory.
It all worked fine. I could execute Java commands from any directory.

Recently I connected a router to provide ADSL connectivity to the Internet.
When I did this I noticed that my command prompt changed from;
[username@localhost username]$
[username@myISP username]$

As soon as the router was connected I found I could no longer get Java commands to work from anywhere.
All I get is error messages such as;
bash: java: command not found

What has happened? Has an environment variable been changed?

Here is the result of echo $PATH;
[username@myISP username]$ echo $PATH

I tried executing after changing to the directory in which it is located as follows;
[username@myISP profile.d]$
bash: command not found

I thought this comand would cause the script to execute, but it did not.
How do I execute this script?

I then manually executed the contents of as root by executing the line of code contained in it as a command from the command prompt as follows;
[root@myISP username]# export PATH=$PATH:/usr/java/j2sdk1.4.2_07/bin/
Then root could access Java commands OK, but only from the directory I was in when I executed the export command.
username could not access Java tools yet.

I then manually executed the contents of as username using the same method.
[username@myISP username]$ export PATH=$PATH:/usr/java/j2sdk1.4.2_07/bin/
Then username could access Java commands OK, but only from the directory I was in when I executed the export command.

After logging out and back in, the effect of these export commands had gone.

It seems that execution of the script at login is not working. Could this be asscociated with the change in host from localhost to myISP when I connected the router? This is after all the event that seemed to trigger this entire problem.

How do I cause Java tools to automatically be accessable from all directories as they once were?
The problem was solved as follows;
in /etc/bashrc I changed the last line from;
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/share/pvm3/


export PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/share/pvm3/

Why it worked I do not know. Any ideas?
Thanks to Daniel from the SLUG (Sydney Linux Users Group).
He saved my bacon.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.