How to setup Java-Home and Path in Ubuntu 12.04
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/profile
export JAVA_HOME=/home/abu/Java/jdk1.8.0_45/ export PATH=$JAVA_HOME/bin:$PATH
- restart the machine and check by
java -version
andjavac -version
Related videos on Youtube
ur truly friend
Updated on September 18, 2022Comments
-
ur truly friend almost 2 years
we are new to
Ubuntu
.Recently we changed my server OS toubuntu 12.04
from windows 7 . every one have their own login details. one of my college installedOpen-Jdk7
. I asked him, where you installedJAVA
, then he suggested to switch the following directorysu root cd /usr/lib/Jvm
Totally 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
inWindows
, we will get 2 folder. 1 folder is forJDK
and another points toJRE
.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 commandsjavac java -version
both commands are working fine.
now I want to set-up
Java-Home and Path
for all users at same place.because everyone is working onApplication server
.Can anyone explain step-by-step.
Thanks.
-
Danatela almost 11 yearsThe best way to setup environment variables for all users is editing
/etc/environment
file. It has pretty simple syntax. And to setup user-specific environment variable you should edit~/.bashrc
file. Add theexport VAR=value
to the end of this file. -
ur truly friend almost 11 yearsI mention like this.
PATH=PredefinePaths:/usr/lib/jvm/java-7-openjdk-amd64/bin
JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
. I didn't mention any special charachers in between Path and JAVA-HOME variables. Is it right, What I did
-
Marko Bonaci over 10 years
JAVA_HOME
should point to a java installation folder, not itsbin
subfolder. And what's with those colons? -
Nitesh Verma over 9 yearsi tried this but still got the same error