From the tutorial you linked, it tells you to "consult the installation instructions" found here: https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html

For Windows JDK, the instructions linked are here: https://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_jdk_install.html#CHDEBCCJ

The part you need to look for is "Updating the PATH Environment Variable"

Updating the PATH Environment Variable

If you do not set the PATH variable, you need to specify the full path to the executable file every time you run it, such as:

C:> "C:\Program Files\Java\jdk1.8.0\bin\javac" MyClass.java

It is useful to set the PATH variable permanently so it will persist after rebooting.

To set the PATH variable permanently, add the full path of the jdk1.8.0\bin directory to the PATH variable. Typically, this full path looks something like C:\Program Files\Java\jdk1.8.0\bin. Set the PATH variable as follows on Microsoft Windows:

Click Start, then Control Panel, then System.

Click Advanced, then Environment Variables.

Add the location of the bin folder of the JDK installation to the PATH variable in System Variables. The following is a typical value

for the PATH variable:

C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.8.0\bin

Note:

The PATH environment variable is a series of directories separated by semicolons (;) and is not case-sensitive. Microsoft Windows looks

for programs in the PATH directories in order, from left to right.

You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored.

If you are not sure where to add the JDK path, append it.

The new path takes effect in each new command window you open after setting the PATH variable.
Answer from Ethan McCormack on Stack Overflow
🌐
Princeton CS
introcs.cs.princeton.edu › java › 15inout › windows-cmd.html
Java and the Windows Command Prompt
You will use the Java compiler ... first step if Java is already installed on your machine. Download and install the latest version of the Java Platform, Standard Edition Development Kit (Java SE 6 Update 27)....
🌐
Oracle
java.com › en › download › help › log_files.html
Java software installation log files
Install Java through command prompt so that it can generate necessary log files to troubleshoot the issue. Goto java.com and click on the Free Java Download button.
Top answer
1 of 2
3

From the tutorial you linked, it tells you to "consult the installation instructions" found here: https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html

For Windows JDK, the instructions linked are here: https://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_jdk_install.html#CHDEBCCJ

The part you need to look for is "Updating the PATH Environment Variable"

Updating the PATH Environment Variable

If you do not set the PATH variable, you need to specify the full path to the executable file every time you run it, such as:

C:> "C:\Program Files\Java\jdk1.8.0\bin\javac" MyClass.java

It is useful to set the PATH variable permanently so it will persist after rebooting.

To set the PATH variable permanently, add the full path of the jdk1.8.0\bin directory to the PATH variable. Typically, this full path looks something like C:\Program Files\Java\jdk1.8.0\bin. Set the PATH variable as follows on Microsoft Windows:

Click Start, then Control Panel, then System.

Click Advanced, then Environment Variables.

Add the location of the bin folder of the JDK installation to the PATH variable in System Variables. The following is a typical value

for the PATH variable:

C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.8.0\bin

Note:

The PATH environment variable is a series of directories separated by semicolons (;) and is not case-sensitive. Microsoft Windows looks

for programs in the PATH directories in order, from left to right.

You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored.

If you are not sure where to add the JDK path, append it.

The new path takes effect in each new command window you open after setting the PATH variable.
2 of 2
0

When ever we execute any command, it is searched in the directory where we are current in or mentioned in PATH environment variable. The oly thing which you need is just add <path of yourjdk>\bin to PATH

Windows 10 and Windows 8

  • In Search, search for and then select: System (Control Panel)
  • Click the Advanced system settings link.
  • Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
  • In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
  • In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.

Windows 7

  • From the desktop, right click the Computer icon.
  • Choose Properties from the context menu.
  • Click the Advanced system settings link.
  • Click the Advanced system settings link.
  • In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
  • Reopen Command prompt window, and run your java code.
🌐
W3Schools
w3schools.com › java › java_getstarted.asp
Java Getting Started
To check if you have Java installed ... mixed mode) If you do not have Java installed on your computer, you can download it at oracle.com....
🌐
Oracle
java.com › en › download › help › windows_manual_download.html
How do I manually download and install Java for my Windows computer?
This will download an executable file (example: jre-8u333-windows-i586-iftw.exe) to the default download location on the local system Note: You can opt to save this file to any other known location on your local system for later installation.
🌐
Oracle
docs.oracle.com › javacomponents › msi-jre › install-guide › installing-jre-command-line.htm
Installing the JRE from the Command Line
Click the Complete List of Java SE downloads (document ID 1439822.1) link in the Downloads (Latest JDK/JRE) section. Click the link of the appropriate Oracle JRE 9 MSI Enterprise Installer for your system and download it. Open an MS-DOS prompt with Administrative permissions. Run one of the following commands depending on the type of installation that you want to perform:
Find elsewhere
🌐
Princeton CS
introcs.cs.princeton.edu › java › windows › manual.php
Hello World in Java on Windows (manual instructions)
From the Command Prompt, type the java command below: You should see the output of the program. To use our standard libraries, you need to download them and add them both to your DrJava classpath and to your CLASSPATH environment variable.
🌐
Florida State University
cs.fsu.edu › ~myers › cop3252 › howto › cmdline.html
Compiling on the Command line with Java SDK
See the account info page for download link · Once you register for an account, you should log into linprog.cs.fsu.edu if you want to use the SDK tools from your CS account login. linprog has the latest Java SDK installed · This machine is running Linux, so you would need to be familiar with basic unix commands (like creating files, directories, moving around, etc).
🌐
GeeksforGeeks
geeksforgeeks.org › java › how-to-run-java-program
How to Run Java Program? - GeeksforGeeks
July 23, 2025 - You can download the JDK from the Oracle website or any other reliable source. Step 2: Write your Java code in a text editor such as Notepad or any other code editor. Save the file with a .java extension and file type as 'All files' in the desired ...
🌐
Oracle
java.com › en › download › help › disable_offers.html
How do I install Java without third party sponsor offers?
Choose the folder location and save the file to your local system. Tip: Save the file to a known location on your computer, for example, to your desktop or Download directory. Click Start. In the Start Search box, type command. A list of matches will appear. click Command Prompt in the Programs list.
🌐
Ask Ai World
askaiworld.com › home › blog › how to run a java program in command prompt (windows guide 2026)
How To Run Java Program In Command Prompt (Step-by-Step Guide 2026)
November 25, 2025 - If you want to run a Java program without installing any heavy IDE, using the Command Prompt (CMD) is the fastest and cleanest method. This guide explains what you need, how it works, when to use CMD, when to avoid it, and the exact steps with zero unnecessary words. ... CMD is lightweight, fast, and ideal for learning the basics of Java execution. ... In such cases, full IDEs like IntelliJ IDEA or Eclipse are better. ... This is the clearest and most accurate method followed by professionals. Download and install the latest JDK from Oracle or OpenJDK.
🌐
Happy Learning
nirupavboricha.wordpress.com › 2016 › 01 › 21 › pogramming-in-java-using-command-prompt-cmd-on-windows-10
Programming in java using command Prompt (cmd) on windows 10 – Happy Learning
March 8, 2017 - Let's first start by installing java on our machine. Visit this link to download java environment: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html Click on the highlighted area, which will ...
🌐
Princeton CS
introcs.cs.princeton.edu › java › windows › command-prompt.php
Using Java from the Command Prompt in Windows
The Command Prompt is necessary for redirecting standard input, redirecting standard output, and piping—you will use these features in Section 1.5. These instructions apply to 32-bit and 64-bit Windows 8, Windows 7, Vista SP1, and XP SP3. You will use the Java compiler javac to compile a ...
🌐
Wikihow
wikihow.com › computers and electronics › software › programming › java › how to compile and run a java program using command prompt
How to Compile and Run a Java Program Using Command Prompt
September 28, 2025 - It is free and can be found at this link: https://www.oracle.com/java/technologies/downloads/. If you are not running the latest version of Java, you can update Java in the Java control panel.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-program-open-command-prompt-insert-commands
Java Program to Open the Command Prompt and Insert Commands - GeeksforGeeks
April 22, 2025 - It is done by passing "cmd" command to exec() method. ... // Java program to illustrate // open cmd prompt class Geeks { public static void main(String[] args) { try { // Just one line and you are done !
🌐
Codecademy
codecademy.com › article › java-for-programmers-java-and-the-command-line
Java and the Command Line | Codecademy
While there are many IDEs with built-in execution capabilities (Eclipse and IntelliJ for example), Java can also be run directly from the command line. In this article, we’ll cover how to download and run Java on your personal computer, as well as how to utilize the String[] args parameter of the main method.
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › download-install-java-windows-linux-macos
Installing Java on Windows, Linux, and macOS - GeeksforGeeks
April 20, 2026 - Here, we will discuss how to download and install Java on a Windows 64-bit Machine and set up the environment to run the first Java program on the command prompt. The process is the same for all Windows i.e.