How to Set Java Path and Classpath in Windows 10?


Java Path and Classpath are the important Java environment variables. Setting these paths allow you to compile and run Java programs through command prompt. Setting these paths is easy, but programmers and developers usually forget the steps to set them. Here is a complete tutorial to set these paths in Windows 10.

  1. Open the computer properties, or right-click on computer icon, and select Properties from context menu. A System window will open.Java Environment s1
  2. Go to navigation section, it is on left side of interface. Click Advanced system settings, a small System Properties window will open.
  3. Click Environment Variables, an Environment Variables window will open.
  4. Go to User variables section, and click New….Java Paths s2
  5. A small New User Variable window will open. In this window, enter “Java_Home” in Variable name: textfield and JDK folder address (e.g. “C:\Program Files (x86)\Java\jdk1.8.0_92″) in Variable value: textfield, and click OK.
  6. Go back to Environment Variables window, then go to System variables section, select Path from the list, and click Edit….Java Path s3
  7. A small Edit System Variable window will open. Copy the JDK bin and lib paths from the JDK folder (e.g. “C:\Program Files (x86)\Java\jdk1.8.0_92\bin”, “C:\Program Files (x86)\Java\jdk1.8.0_92\lib”) , paste them at the end of Variable value: textfield, and click OK.
  8. Go back to Environment Variables window, click OK.
  9. Go back to System Properties window, and click OK.

Once you’ve completed the above steps, then it is recommended to check everything is okay. It can be done by opening the command application, typing “Java”, and pressing Enter. If everything is okay, you’ll see texts in the Command Prompt something like this.

Set Java - Checking Java

If programmers do not set java paths, then they can’t compile and run the programs through command applications and IDEs. The above tutorial is simple, and it will take a few minutes to implement it.