Jumat, 14 Juni 2024

Set The JAVA_HOME variable

Set The JAVA_HOME Variable In Microsoft Windows 11

<< Previous lesson: Default Java Path Environment
  1. Let’s locate the directory where the JDK is installed on our system, and note down the path to this directory.
  2. Open the Start menu and click All apps in the upper-right corner.
  3. Scroll through the list of apps and click Windows Tools.
  4. Click Control Panel.
  5. Under View by, click Large icons to view a list of all Control Panel items, then select System.
  6. In the System window, click on Advanced System Settings on the left sidebar.
  7. 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).
  8. 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.
  9. 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:
  1. Open Command Prompt (make sure you Run as administrator so you're able to add a system environment variable).
  2. 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"
  3. 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%
  4. 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

Related Post

Tidak ada komentar:

Posting Komentar

Various Other Posts