Table of Contents
Install Java on Windows
Follow my steps to download and install Java, without having an error:
1. Download the JDK file from here. Accept the agreement and download.
2. Install Java from the download source and double-click to install.
3. Leave all the settings as defaults unless you have a reason to change them. Click next till you see this screen.
C:\Program Files\Java\jdk\bin>
java --version
java 15.0.2 2019-07-16
Java(TM) Runtime Environment (build 15.0.2+10)
Java HotSpot(TM) 64-Bit Server VM(build 15.2.2+10, mixed mode, sharing)
C:\Program Files\Java\jdk\bin>
Set Environment Variable for Java
To access Java directly from the command prompt, you just have to set the environment variable. Follow my steps:1. Right-click on This PC > Properties > Advanced System Settings > Environment Variable.
2. Create a new user variable. Set the variable name to JAVA_HOME and Variable Value to C:\Program Files\Java\jdk.
3. Now in system variables double click on the path and paste here the path of bin file inside JDK folder.
4. Save them all and open command Prompt(CTRL+R and type cmd) and run java.
Microsoft Windows[Version 6.3.9600]
(c) 2013 Microsoft Corporation. All right reserved.
C:\users\mrdev> java --version
java 15.0.2 2019-07-16
Java(TM) Runtime Environment (build 15.0.2+10)
Java HotSpot(TM) 64-Bit Server VM(build 15.2.2+10, mixed mode, sharing)
C:\users\mrdev>
Now you see you have successfully installed Java in your system.
Java For Linux
Java comes pre-installed with any Linux distros. If Java is not in there then run the following commands:
┌──(mrdev㉿kali)-[~/Desktop]
└─$ sudo apt-get install default-jdk
#To download JDK
┌──(mrdev㉿kali)-[~/Desktop]
└─$
sudo apt-get install default-jre
#To download JRE