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/environment
is available for all the user?
sudo update-java-alternatives -s /usr/lib/jvm/jdk1.7....full path needed here
see if works (withjava
andjavac
) . 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"
java
javac
and something else.