- Where is Java Installed in Windows
- Where is Java Installed in Windows
- Conclusion
- About the author
- Anees Asghar
- Find Java Location in Windows
- Find Java Location Using Command where java
- Find Java Location Using Command set JAVA_HOME
- Find Java Location Using Command dir /b /s java.exe
- Find Java Location Using Command gcm -All java in Windows PowerShell
Where is Java Installed in Windows
Java is an object-oriented, client-side, platform-independent programming language that is used to develop various software such as web development, android applications development, games development, etc. It is widely used all over the world and is freely available for all the platforms like Windows, Mac, Linux, etc.
Considering these dominant features most of the developers, students, etc run java on their machines. However, most java users struggle to check where is java located. So, in this write-up we will assist you in this regard. So, let’s get started!
Where is Java Installed in Windows
You have to go through the below-given steps to check the location where java is installed on the Windows operating system.
First Step
Firstly, you need to check whether the java is installed on your Windows operating system or not! To do so, type the below-given command on the window’s command prompt:
If java is properly installed on your system, then you will encounter the following output:
Else if java is not installed on your system then, you will get the output something like this:
Maybe your output message differs a little bit because it depends on the java version that is installed on your operating system.
Second Step
If you don’t know how to install java, then visit this link that will assist you step-by-step in downloading and installing java on the windows operating system.
Third Step
Once you are sure that the java is installed on your system then you can check the java’s installation location by typing the below-given command:
Typing the above-mentioned command will show the following output:
The above snippet shows that java is located on the following path “C:\Program Files\Java\jdk-17.0.1”.
Fourth Step
If java is properly installed on your Windows, but still, you are unable to find the location of Java. This means you didn’t set the “JAVA_HOME” variable properly on your system.
To set up the Java_home variable, we have to follow the following steps:
- Search for the “view advanced system settings” in the window’s search bar and select it.
- Click on the Environment Variables.
- Select “User Variables” and click on “New” button.
- Type “JAVA_HOME” as the variable name and specify the path to JDK as the variable value.
- Locate the path variable and press OK.
- Repeat the whole process for “System Variables” and press OK.
- This process will set the Java_home variable on your windows operating system.
For detailed understanding of how to configure the java environment please visit this link: how to set the environment for java
Conclusion
Type echo %JAVA_HOME% in the windows command prompt to find the folder’s location where Java is installed. It will return the complete path of java’s installation folder e.g., “C:\Program Files\Java\jdk-17.0.1”. This write-up explained how to check if java is installed on Windows operating system or not. If installed! Then how to check where it is located.
About the author
Anees Asghar
I am a self-motivated IT professional having more than one year of industry experience in technical writing. I am passionate about writing on the topics related to web development.
Find Java Location in Windows
- Find Java Location Using Command where java
- Find Java Location Using Command set JAVA_HOME
- Find Java Location Using Command dir /b /s java.exe
- Find Java Location Using Command gcm -All java in Windows PowerShell
Today, we will see how to find out where Java is located in Windows. There are multiple ways and commands to do this; we will check out various commands that return the Java location windows.
Find Java Location Using Command where java
The most commonly used command to get the current location of Java in Windows is where java . This is a Windows command that works just like the whereis command in Linux Operating System. The where command is used to display the location of the executable. It usually uses a search pattern.
As shown below, when we run the command where java in the command line of Windows, it returns the location of java.exe .
C:\User\.jdks\openjdk-15.0.1\bin\java.exe
Find Java Location Using Command set JAVA_HOME
The next technique to get the location of Java in Windows is to use the command set JAVA_HOME . In Windows, the path of Java or JDK is stored in the environment variables. The location is stored in the variable named PATH , a list of directories that can be used to access certain programs like Java directly without writing the whole path.
We can set the path of Java by the command set JAVA_HOME and then specify the path. But if the value is already set, it will return the path set to the variable JAVA_HOME . It completes our goal as this is the directory in which Java is located.
C:\Users\Rupam Saini>set JAVA_HOME
JAVA_HOME=C:\Users\Rupam Saini\.jdks\openjdk-15.0.1
Find Java Location Using Command dir /b /s java.exe
The dir command shows all the folders and sub-folders in the current location. We can use this command to get the locations of Java as there might be more than one executable of Java in a single Windows machine as some programs use their own Java environment.
We use the dir command with three parameters, first is /b that displays only the directory path without any extra details. In contrast, the /s parameter lists every occurrence of the specified file in the current directory and subdirectories, and at last, the execute name that is java.exe .
C:\User\.jdks\openjdk-15.0.1\bin\java.exe C:\User\AppData\Local\JetBrains\IntelliJ IDEA Community Edition 2020.3\jbr\bin\java.exe
Find Java Location Using Command gcm -All java in Windows PowerShell
In all the examples in this tutorial, we use the traditional command-line,, but this method requires the Windows PowerShell, a command-line but with advanced capabilities. In PowerShell, we use the gcm command that is short for get-command . It returns all the commands in the machine.
We use gcm with two parameters; the first is -All that shows all the instances of the command in the current machine, and the second parameter is the command name. In our case, the command name is java . In return, it outputs some details about the command like the Command Type, the name of the executable executed on command, the version, and the executable source. The source is where Java is located.
CommandType Name Version Source ----------- ---- ------- ------ Application java.exe 15.0.1.0 C:\User\.jdks\openjdk-15.
Rupam Saini is an android developer, who also works sometimes as a web developer., He likes to read books and write about various things.