To configure the JAVA_HOME
and PATH
variables, follow these steps:
Installing on a LINUX environment:
shell> sudo add-apt-repository ppa:webupd8team/java shell> sudo apt-get update shell> sudo apt-get install oracle-java7-installer
shell> sudo gedit /etc/environment
JAVA_HOME="/usr/lib/jvm/java-7-oracle"
PATH
variable, add the /usr/lib/jvm/java-7-oracle/bin:
string./etc/environment
file should look like this:In Windows environments:
JAVA_HOME
system variable, click on the New... button that is found in the System variables section:JAVA_HOME
.JAVA_HOME
and complete its value with the corresponding path, say, C:Program FilesJavajdk1.7.0_04, as shown in the following screenshot:PATH
variable and click on the Edit... button.PATH
variable, add the %JAVA_HOME%in;
string.PATH
entries in the Windows environment is ; as shown in the following screenshot:To confirm the correct installation in Linux as well as in Windows, we can execute the following command in a terminal:
shell> java -version
We should obtain a result similar to the following:
java version "1.7.0_04" Java(TM) SE Runtime Environment (build 1.7.0_04-b20) Java HotSpot(TM) Server VM (build 23.0-b21, mixed mode)
We installed JDK and configured the JAVA_HOME
and PATH
environment variables. Configuration was performed for both the Linux and Windows operating systems. We defined the JAVA_HOME
environment variable that points to a local Java installation. We also added the Java bin
directory to the PATH
variable so that we can call Java from anywhere.