Set The JAVA_HOME Variable In Microsoft Windows 11
<< Previous lesson: Default Java Path Environment
- Let’s locate the directory where the JDK is installed on our system, and note down the path to this directory.
- Open the Start menu and click All apps in the upper-right corner.
- Scroll through the list of apps and click Windows Tools.
- Click Control Panel.
- Under View by, click Large icons to view a list of all Control Panel items, then select System.
- In the System window, click on Advanced System Settings on the left sidebar.
- In the System Properties window (Advanced tab):
- Click the Environment Variables button.
- Under the System Variables section, find JAVA_HOME.
- Click Edit to modify the existing variable, or New to create a new one.
- In the Variable Name field, enter JAVA_HOME.
- In the Variable Value field, enter the path to our JDK installation directory (e.g., C:\Program Files\Java\jdkX.X.X_XX).
- In the System Properties window, select the Path variable under the System Variables section. Click Edit, and add %JAVA_HOME%\bin to the list of paths if it’s not already there.
- Click OK to apply the changes and restart the computer to ensure the changes take effect.
Set The JAVA_HOME Variable Via The Command Line
If you would prefer to set the JAVA_HOME (or JRE_HOME) variable via the command line:
- Open Command Prompt (make sure you Run as administrator so you're able to add a system environment variable).
- Set the value of the environment variable to your JDK (or JRE) installation path as follows:
setx /m JAVA_HOME "C:\Program Files\Java\jdkXX.X.XX.X" - Close and start Command Prompt window again to reload the environment variables then use the following command to check the it's been added correctly.
echo %JAVA_HOME% - You should see the path to your JDK (or JRE) installation.
NOTES: X is version based on your Java installed version.
Bibliography
https://support.microsoft.com/en-us
https://www.baeldung.com/
https://www.groovypost.com/
install, setup, installation
Tidak ada komentar:
Posting Komentar