I am using the 12.04LST, and I am trying to install the oracle jdk7 manually.
Then I update the /etc/environment to set the PATH variable.
This is the original file content:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
And I update it as this:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
JAVA_HOME="/usr/lib/jvm/jdk1.7"
PATH="$PATH:$JAVA_HOME/bin"
Then I make it work using:
source /etc/environment
Then I type java and javac, and it worked.
However after I reboot my computer, I was kept at the login screen.
Then I use ctrl+alt+f2 to go the terminal.
And update the /etc/envrionment like this:
/usr/bin/sudo /usr/bin/nano /etc/emvrionment to the following:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
JAVA_HOME="/usr/lib/jvm/jdk1.7"
Then I can login again.
Now I have two questions:
Why I can not login if I add the line
PATH="$PATH:$JAVA_HOME/bin"in/etc/envirionment?Is variables set in
/etc/environmentis available for all the user?
http://askubuntu.com/questions/128413/setting-the-path-so-it-applies-to-all-users-including-root-sudo
http://superuser.com/questions/339617/how-to-reload-etc-environment-without-rebooting
– Fragles Apr 25 '13 at 00:20sudo update-java-alternatives -s /usr/lib/jvm/jdk1.7....full path needed heresee if works (withjavaandjavac) . Alternatively you can try to set the path directly to PATH (without create a new variable)PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/jdk1.7"– NickTux Apr 25 '13 at 00:29javajavacand something else. – hguser Apr 25 '13 at 00:34