How to Set JAVA_HOME for JDK & JRE: A Step-by-Step Guide

How to Set JAVA_HOME for JDK & JRE: A Step-by-Step Guide

Setting JAVA_HOME for JDK & JRE

Setting the JAVA_HOME environment variable is crucial when working with Java Development Kit (JDK) and Java Runtime Environment (JRE) on your system.

Step 1: Determine the Path to Your JDK & JRE

First, you need to identify the installation directories of your JDK and JRE.

For JDK, the path is usually something like C:\Program Files\Java\jdk-15.

For JRE, the path is typically C:\Program Files\Java\jre-15.

Step 2: Set JAVA_HOME on Windows

1. Right-click on ‘This PC’ or ‘My Computer’ and select ‘Properties’.

2. Click on ‘Advanced system settings’ on the left panel.

3. In the ‘System Properties’ window, click on the ‘Environment Variables’ button.

4. Under ‘System Variables’, click ‘New’ and add JAVA_HOME as the variable name and the path to your JDK installation as the variable value (e.g., C:\Program Files\Java\jdk-15).

Step 3: Verify the JAVA_HOME Variable

To ensure that the JAVA_HOME environment variable is set correctly, open Command Prompt and type ‘echo %JAVA_HOME%’. You should see the path to your JDK or JRE installation.

Setting the JAVA_HOME environment variable is essential for Java developers to compile and run Java programs seamlessly. By following these steps, you can easily set up JAVA_HOME for JDK and JRE on your Windows system.

Leave a Reply

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