How to Print java Environment Variable using Command Prompt in Microsoft Windows

Posted on

How to Print java Environment Variable using Command Prompt in Microsoft Windows

This is an article where the main focus is on how to print java environment variable. It will use a certain command to be able to do that. Furthermore, the command itself will have to go through an execution process. Carrying the process for the command execution will use the help of Command Line Interface. For the execution process, it will take place in a device running using Microsoft Windows as its operating system. For a device using Microsoft Windows as its operating system, Command Prompt will be the suitable choice to run the command.

Preparation

Below are steps for executing the preparation so that printing java environment variable will be possible to carry out :

  1. Run the Command Prompt. Use any available user. Either a user for logging in to the device which is currently active in the session or switching to Administrator role.

  2. Type ‘java’ to check the existence of the ‘java’ tool or ‘java’ file program. If it works, then most likely the JAVA_HOME environment variable is already exist. If it is not, then most likely ‘java’ tool or ‘java’ program is not available in the device. In that case, just install the ‘java’ tool or the ‘java’ program in the device. Read an article for installing ‘java’ tool or ‘java’ program. Among those article are the one with the title ‘How to Install JDK Java Development Kit in Microsoft Windows 10’ in this link.

  3. The above step is also possible using another type of command. Instead of using or typing ‘java’ in the Command Prompt, just type ‘where java’ in the Command Prompt to be able to retrieve an output informing the path of the java.exe file program. The execution of the command ‘where java’ will print location of the ‘java’ tool or ‘java program in the Command Prompt.

Printing the java Environment Variable

After the Command Prompt appear, just type ‘echo %JAVA_HOME%’ in the Command Prompt. Normally, the environment variable name will be ‘JAVA_HOME’. So, the command for printing the java environment variable will be ‘echo %JAVA_HOME%’. For more information about the steps on how to do that, just watch it in the following video :

Leave a Reply