Java Environment Setup

To execute a java program, we want to compile the java source code (.class file) to JVM.

To develop, compile and execute a java program we need to install Java in our system. To check whether java is already installed in your PC’s, open Command Prompt(CMD) and type,

java -version

If it shows like this,

java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) Client VM (build 25.251-b08, mixed mode, sharing)

Java is installed in your, if it shows any error you want to download java from here

After downloading java, install it in your system and follow the steps to set path for windows,

Step 1: Press Win+R to open Run dialog box and type sysdm.cpl and hit enter, this will open system properties.

Step 2: Clicking on the Advanced tab settings in the system properties dialog box.

Step 3: Clicking on the Environment Variables button at the bottom right in advanced tab.

Step 4: Click on Environment variable, in System variable, click on New button.

Step 5: In variable name, type JAVA_HOME and in variable path add the path where Java is installed, by default, java is installed in C:\Program Files\Java\jdk-12.0.1

Now paste the copied path C:\Program Files\Java\jdk-12.0.1\bin in variable path and click on ok and save the settings.

Now open your command prompt and type java -version, now it will show the version of java.

We can also set temporary path for java using Command Prompt using the below command,

C:\Users\neuralbeast>set path=C:\Program Files\Java\jdk-12.0.1\bin

and hit enter. This will set temporary path for java.

More Reading

Post navigation


Leave a Reply

Your email address will not be published. Required fields are marked *