- 1 year ago
Paths to multiple JDK's in windows system variable PATH
To include multiple JDK paths in the PATH
environment variable on Windows, you need to separate each path with a semicolon (;). Here's an example of how you can add multiple JDK paths to the PATH
variable:
Press Win + R to open the Run dialog box.
Type
sysdm.cpl
and press Enter to open the System Properties window.Go to the "Advanced" tab and click on the "Environment Variables" button.
In the "System variables" section, locate the
PATH
variable and click on "Edit".In the "Edit Environment Variable" window, add the paths to your JDK installations, separated by semicolons. For example:
vbnetC:\path\to\jdk1.8.0\bin;C:\path\to\jdk11\bin;C:\path\to\jdk14\bin
Replace
C:\path\to\jdkX
with the actual paths to your JDK installations. Make sure to separate each path with a semicolon.Click "OK" to save the changes.
Note that the order of the JDK paths in the PATH
variable matters. When you run a command, the system searches for the executable in the directories specified in the PATH
variable in the order they appear. Therefore, if you have multiple JDKs with the same executable names (e.g., java
, javac
), the JDK listed first in the PATH
variable will take precedence.
After updating the PATH
variable with the multiple JDK paths, you should be able to use the desired JDK version based on the order specified in the PATH
variable when running Java-related commands or programs.
Remember to restart any open command prompt or terminal windows for the changes to take effect.