JDK Installation On Window and Ubuntu
JDK Installation On Window and Ubuntu
$ java -version
[If Java is already, installed on system, it gives the response somewhat like below for java-7 –
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b13)
Java HotSpot(TM) Client VM (build 25.0-b02, mixed mode)
In case Java is not installed, then Install Java with following command.]
$ sudo apt-get install openjdk-7-jdk
$ source $HOME/.bashrc
Installation on Window
1. Download JDK
Download the latest and compatible version of JDK from the below link
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-
2133151.html
If you are saving the java source file inside the C:\Program Files\Java\jdk1.8.0_121\bin
directory, path is not required to be set because all the tools will be available in the current
directory.
But, if you are having your java file outside the C:\Program Files\Java\jdk1.8.0_121\bin folder, it
is necessary to set path of JDK. Path can be set in two ways: temporary and permanent.
Open a Windows command prompt (Windows key + R -> enter cmd -> OK). Write following
command in command prompt. For different version of jdk or different location, copy the path of
jdk/bin directory (your JDK installation path may be different).
Right-click on Computer -> Properties -> Advanced system settings; then in the Advanced tab,
click Environment Variables... -> System variables -> New....
Give the new system variable the name JAVA_HOME and the value value C:\Program
Files\Java\jdk1.8.0_121 (depending on your JDK installation path it varies).
Then select the Path system variable and click Edit.... Keep the variable name as Path, and
append C:\Program Files\Java\jdk1.7.0_79\bin; or %JAVA_HOME%\bin; (both mean the same)
to the variable value. Do not delete any content already present there in the value of path.
The same procedure can be repeated for the user variables (Computer -> Properties -> Advanced
system settings; then in the Advanced tab, click Environment Variables... -> User variables)
Open a Windows command prompt (Windows key + R -> enter cmd -> OK), and check the
following:
> java -version
> javac –version
Notepad++: Notepad++ is a free source code editor that supports several languages can
be downloaded from https://notepad-plus-plus.org/
Netbeans: A Java IDE that is open-source and free which can be downloaded
from https://www.netbeans.org/index.html
Eclipse: A Java IDE developed by the eclipse open-source community and can be downloaded
from https://www.eclipse.org/
References
https://stackoverflow.com/questions/1672281/environment-variables-for-java-installation
http://docs.oracle.com/javase/tutorial/essential/environment/paths.html
https://www.java.com/en/download/help/path.xml
https://www.javatpoint.com/how-to-set-path-in-java
https://www.tutorialspoint.com/java/java_environment_setup.htm