we are new to Ubuntu.Recently we changed my server OS to ubuntu 12.04 from windows 7 . every one have their own login details. one of my college installed Open-Jdk7. I asked him, where you installed JAVA, then he suggested to switch the following directory
su root
cd /usr/lib/JvmTotally 3 folders are there in JVM folder. names are.
java-1.7.0-openjdk-amd64
java-7-openjdk-amd64
java-7-openjdk-common
generally, If you install Java in Windows, we will get 2 folder. 1 folder is for JDKand another points to JRE.
but, in Ubuntu we have 3 folders. is it right?
for my conformation, whether he installed correctly or not. I open Terminal. I run the following 2 commands
javac java -versionboth commands are working fine.
now I want to set-up Java-Home and Path for all users at same place.because everyone is working on Application server.
Can anyone explain step-by-step.
Thanks.
33 Answers
Installation of Oracle Java:
- Donwload the tarball from Oracle website
unzip it using this command:
sudo tar -xvpzf fileName -C /installation_folder_name`- change the files permission and ownership
add the following two lines in
/etc/profileexport JAVA_HOME=/home/abu/Java/jdk1.8.0_45/ export PATH=$JAVA_HOME/bin:$PATH- restart the machine and check by
java -versionandjavac -version
Edit the system Path file /etc/profile
sudo -H gedit /etc/profile # always use -H when you sudo a gui program or anything else which might write config files to the $HOME directory.Add following lines in end
JAVA_HOME=/usr/lib/jvm/jdk1.7.0
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATHFor complete installation guide..
1sudo gedit /etc/environmentthen add these lines
JAVA_HOME = ":usr/lib/jvm/java-7-openjdk-amd64/bin"
CLASSPATH = ":usr/lib/jvm/java-7-openjdk-amd64/bin:/home/something etc whatever you want etc" ( separated by semicolon ) 1