How to set the environment variables for Java in Windows

Viewed 1080879

How to set the environment variables for Java in Windows (the classpath)?

17 Answers
  1. Download the JDK
  2. Install it
  3. Then Setup environment variables like this :
  4. Click on EDIT

enter image description here

  1. Then click PATH, Click Add , Then Add it like this: enter image description here

Java path set for java 11

  1. copy the path for jdk-11

Don’t include the \bin folder, just the JDK path. For example

CorrectC:\Program Files\Java\jdk-11

WrongC:\Program Files\Java\jdk-11\bin

In environmental variable, user variable section click on New button and give path like below. enter image description here

after that give ok for it and go to the System variables and select the Path and double click on it.

enter image description here

click on new and paste %JAVA_HOME%\bin and click ok to all. enter image description here

Your Keytools file sit under "Java/bin" folder so you need to either set Environment variable or go to "Java/bin" folder and run command

You can add JAVA_HOME in the system environment variable from my computer>>advance tab>add the new path as explained here.

It might help Mac and Linux users as well.

Related