Java Development Kit (JDK) allows you to code, and run Java programs. It's possible that you install multiple JDK versions on the same PC. But It's recommended that you install only the latest version.
6. Open jdk folder, and open bin file. Now open the command from here by holding the shift key and right key on your mouse.
4. Save them all and open command Prompt(CTRL+R and type cmd) and run java.
Install Java on Windows
Follow my steps to download and install Java, without having an error:
1. Download 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
Post a Comment
If you have any doubts or any queries you can specify here.