To install Java follow below steps:
- Identify your system architecture.
- Download & install JDK (Java Development Kit).
- Set path (JDK's bin directory).
Identify System Architecture
Your System architecture will be either 32-bit or 64-bit. x64 represents 64-bit OS and x86 represents 32-bit OS. You can check it as below:
- Windows users: right-click on my computer then go to properties there you will find system type.
- linux/unix users: run "arch" command (without quotes).
Download & Install JDK
- Download "Java SE Development kit" from here
- Go to above link then accept license agreement and then select to download suitable version based on your operating system and it's architecture(32bit/64bit).
- Once the file is downloaded, install it
Set Path for Windows
Follow below steps to set path in windows.
- Right-click on "my computer" then click on properties.
- From left navigation click on "Advanced System Settings".
- Now go to advanced tab, there click on "environment variables"
- Check if variable named "Path" or "PATH" is already present, if yes then append your JDK's bin directory path. For example if current value of Path variable is "C:\windows\system32" then append like following C:\windows\system32;C:\Program Files\Java\jdk1.8.0_121\bin;(change as per path in your system).
- And if variable named Path is not present then create new variable give name "Path"(without quotes) and value C:\Program Files\Java\jdk1.8.0_121\bin(change as per path in your system).
Set Path for Linux/Unix
- Open .profile file present in your home directory or if not present then create new file named ".profile" and open.
- Now copy and paste following line
export PATH=$PATH:/home/jdk1.8.0_121/bin/ (change path according to your java installation path) and save the file.
How to check whether the path is correctly set or not?
- Open command prompt.
- Run command "javac" , if the command is recognized then it's ok, otherwise check your path setting.
- check the same by running command "java".