2
I think this sequence of commands explains my whole question:
[Ramy@Moonface Downloads]$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Server VM (build 17.1-b03, mixed mode)
[Ramy@Moonface Downloads]$ su -
Password:
[root@Moonface ~]# java -version
bash: java: command not found
Running fedora 13
I suppose it's worth explicitly asking: what steps do I need to take to be able to invoke java as root?
more info:
[Ramy@Moonface ~]$ which java
/usr/java/jdk1.6.0_22/bin/java
[Ramy@Moonface ~]$ echo $PATH
/usr/java/jdk1.6.0_12/bin:/usr/java/jdk1.6.0_12/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/ sbin:/usr/sbin:/sbin:/home/Ramy/bin:/usr/java/jdk1.6.0_22/bin
[Ramy@Moonface ~]$ su -
Password:
[root@Moonface ~]# which java
/usr/bin/which: no java in (/usr/java/jdk1.6.0_12/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/roo t/bin)
[root@Moonface ~]# echo $PATH
/usr/java/jdk1.6.0_12/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
UPDATE: so obviously "/usr/java/jdk1.6.0_22/bin" is missing from the path for root. How can I add it to the path for root?? here is my ~/bash_profile:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export JAVA_HOME="/usr/java/jdk1.6.0_22"
i've updated my question but I need some further help. I'm not sure how to modify my path or what way to modify it. – Ramy – 2011-07-20T01:57:36.660
Hi, you can change the PATH environment variable in shell configuration files. The location varies from distribution to distribution, but you can generally find it in /etc (e.g. /etc/bash.bashrc, /etc/profile, /etc/profile.d/*). You can find details by googling "[distribution name] change path". You may also need to set JAVA_HOME to make sure java finds the correct libraries. – billc.cn – 2011-07-20T02:08:43.753