Add the appropriate javac path to your PATH variable. java.exe will be found under the bin directory of your JDK. E.g.

SET PATH=%PATH%;C:\Program Files (x86)\Java\jdk1.6.0_05\bin
Answer from krock on Stack Overflow
🌐
Princeton CS
introcs.cs.princeton.edu › java › 15inout › classpath.html
Setting the Classpath in Java
Go to that directory and compile them. ... From DrJava, choose the menu option Edit -> Preferences -> Resource Locations -> Extra Classpath -> Add and select C:\introcs. Click the Apply button, then the OK button. To set the classpath for the Windows XP Command Prompt:
🌐
Oracle
docs.oracle.com › javase › tutorial › essential › environment › paths.html
PATH and CLASSPATH (The Java™ Tutorials > Essential Java Classes > The Platform Environment)
If CLASSPATH is not set you will get a CLASSPATH: Undefined variable error (Solaris or Linux) or simply %CLASSPATH% (Microsoft Windows NT/2000/XP).
🌐
Chilkat
chilkatsoft.com › java-classpath-Windows.asp
Java JAR Archives and classpath on Windows
For more information, these Google searches produce good results: "windows 7 environment variables", "windows xp environment variables", etc. Set the classpath at runtime. There are several possible ways of doing this: Use the -classpath option: javac -classpath ".;C:/chilkatJava/chilkat.jar" Test.java java -classpath ".;C:/chilkatJava/chilkat.jar" Test ·
🌐
Blogger
javarevisited.blogspot.com › 2011 › 01 › how-classpath-work-in-java.html
How to Set Classpath for Java on Windows and Linux? Steps and Example
You can also set classpath in windows by using DOS commands like: $ set CLASSPATH=%CLASSPATH%;JAVA_HOME\lib; This way you can set the classpath in Windows XP, Windows 2000, or Windows 7 and 8, 10 as they all come with a command prompt.
🌐
Oracle
docs.oracle.com › javase › › 7 › docs › technotes › tools › windows › classpath.html
Setting the class path
The class path is the path that the Java runtime environment searches for classes and other resource files. The class search path (more commonly known by the shorter name, "class path") can be set using either the -classpath option when calling a JDK tool (the preferred method) or by setting ...
🌐
HowToDoInJava
howtodoinjava.com › home › java basics › java classpath
How to set CLASSPATH in Java - HowToDoInJava
February 23, 2023 - If CLASSPATH is not set you will get a CLASSPATH: Undefined variable error (Solaris or Linux) console or simply %CLASSPATH% printed in the windows command prompt. Happy Learning !! ... There is a subtle but serious bug in the code outlined in section 3 that can be instructive to understanding that classpath is where JVM looks for all classes and not just for dependant classes. The first statement “$ javac –classpath C:\dependency\framework.jar MyApp.Java” compiles fine and places the MyApp.class file in the current directory.
🌐
Edureka
edureka.co › blog › set-java-classpath
How To Set Classpath In Java | Java Path And Classpath | Edureka
June 19, 2023 - Whenever a Java application executes it checks for Java classes in CLASSPATH in order to execute without any error. It commonly contains paths to Jar files with OS path separator in windows it is ‘;’.
Find elsewhere
🌐
Oracle
docs.oracle.com › javase › 8 › docs › technotes › tools › windows › classpath.html
2 Setting the Class Path
April 21, 2026 - The class path is the path that the Java Runtime Environment (JRE) searches for classes and other resource files. ... The class search path (class path) can be set using either the -classpath option when calling a JDK tool (the preferred method) or by setting the CLASSPATH environment variable.
🌐
Baeldung
baeldung.com › home › java › core java › java classpath syntax in linux vs. windows
Java Classpath Syntax in Linux vs. Windows | Baeldung
January 8, 2024 - # On Windows system: CLASSPATH="PATH1;PATH2;PATH3" # On Linux system: CLASSPATH="PATH1:PATH2:PATH3" We’ve learned that the classpath separator can be different depending on the operating system. However, if we take a closer look at the Java man page on Linux, it says the classpath separator is the semicolon (;).
🌐
Princeton
cs.princeton.edu › courses › archive › fall97 › cs461 › jdkdocs › tooldocs › win32 › classpath.html
classpath - Environment Variables
The CLASSPATH environment variable tells the Java Virtual Machine and other Java applications (for example, the Java tools located in the jdk1.1.x\bin directory) where to find the class libraries, including user-defined class libraries.
🌐
HowToDoInJava
howtodoinjava.com › home › java examples › java – set classpath from command line
Java - Set Classpath from Command Line
January 25, 2022 - Learn to use the -classpath or -cp option to set the Java classpath from the command prompt in Windows and Linux OS.
🌐
Blogger
javarevisited.blogspot.com › 2013 › 02 › windows-8-set-path-and-classpath-java-windows-7.html
How to set Java Path and Classpath in Windows 7, 8 and Windows 10 - Tutorial
JDK bin directory contains javac and java commands to compile and run Java programs. CLASSPATH is a little different than Path and it's used by JVM rather than Operating System to load classes at runtime.
🌐
Wikipedia
en.wikipedia.org › wiki › Classpath
Classpath - Wikipedia
May 30, 2026 - The environment variable named CLASSPATH may be alternatively used to set the classpath. For the above example, we could also use on Windows: D:\myprogram>set CLASSPATH=D:\myprogram D:\myprogram>java org.mypackage.HelloWorld
🌐
GeeksforGeeks
geeksforgeeks.org › java › how-to-set-classpath-in-java
How to Set Classpath in Java? - GeeksforGeeks
July 23, 2025 - It allows the system to locate the Java executables to compile and run programs. The CLASSPATH variable is used to specify the location of the Java class files and libraries required for the program.
🌐
Medium
medium.datadriveninvestor.com › java-classpath-know-it-and-use-it-correctly-2cf6e4dc87ee
Java Classpath, know it, and use it correctly! | by Tom Henricksen | DataDrivenInvestor
June 29, 2022 - Although we discussed the PATH before here we haven’t talked about CLASSPATH. The CLASSPATH helps the Java Virtual Machine or JVM know where to look for resources. The PATH is geared toward the operating system. If you are on Windows it needs to know where to look for the file or application you are running.
🌐
Full Boar LLC
fullboarllc.com › home › setting the classpath variable in windows 10
Setting the CLASSPATH Variable in Windows 10 - Full Boar LLC
February 15, 2021 - Note, you do not always need to modify the CLASSPATH variable. As an alternative you can simply pass the path of the JAR file to java using the -cp command line argument. You can find more about that here. Follow the steps below to add the CLASSPATH variable to your Windows 10 environment variables:
🌐
Quora
quora.com › How-do-I-set-a-Java-classpath-in-Windows
How to set a Java classpath in Windows - Quora
Answer (1 of 2): Setting Java class path in Windows is a piece of cake. You just have to paste the “bin” directory path from the installed JDK in the “path” system variable. In case of Windows 7, 8, or 10: 1. From the desktop, right click the Computer icon.