Java Install

Downloading the JDK installer

http://www.oracle.com/technetwork/java/javase/downloads/index.html
JDK 11
Windows Java 11 Installer
Since Java 9, Oracle Java does not support 32-bit Windows systems.
Therefore, install the latest version of Java 8 on 32-bit Windows systems.

Installation can be completed simply by clicking the "Next" button.
The JDK is installed in "C:\Program Files\Java\jdk-<version>".

Environment Variable

Click Start, then Control Panel, then System.
System Properties
Select Advanced tab, then Click Environment Variables button.
System Properties Advanced
Click New button in User Variables.

Environment Variables
User variables for JohnDoe
Variable Value
   
   
   
System variables
Variable Value
   
   
   

Creates a new environment variable named JAVA_HOME in User Variables.
The value of JAVA_HOME is the installation directory of the JDK.
To obtain the correct value, use the Windows Explorer.

New User Variable
Variable name:
Variable value:

Click New button in User Variables again.
Creates a new environment variable named Path in User Variables.
The value of Path is %JAVA_HOME%\bin.

New User Variable
Variable name:
Variable value:
Path
The user variable Path value is added to the system variable Path.
Windows OS looks for programs in the system variable Path directories.
if you add the location of the bin folder of the JDK installation for the Path variable, you are able to conveniently run the executables (javac.exe, java.exe, jar.exe, and so on) from any directory Without moving to the directory where the executable program is located, such as:
C:\Users>javac Test.java
If you do not set the Path variable, you need to move to the directory where the executable program is located, such as:
C:\Program Files\Java\jdk-11.0.2\bin>javac C:\Users\Test.java
To confirm the Path, run echo %Path% in command prompt.
Semi-colon (;) is used to separate values of the Path environment variable in Windows.
Colon (:) is used to separate values of the PATH environment variable in Unix and Linux.

Test

Test.java
public class Test {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}
C:\ Command Prompt
C:\Users>javac Test.java

C:\Users>java Test
Hello World!
Test failure checklist
javac Test.java

'javac' is not recognized as an internal or external command, operable program or batch file.
Update the Path Environment Variable

java Test

Exception in thread "main" java.lang.NoClassDefFoundError: Test
The above error occurs when Test.class file was not found.
When you run "java Test" in the directory where Test.class file does not exist, you will get this error.
If you want to run the class in the directory where the class file does not located, use the -cp option of java.exe, such as:

C:\javawork>java -cp C:\Users Test

C:\Users is the directory where the class file is located.
Test is a Java class to run.

Editor

Until Package and Modifiers, it is better to use a simple editor such as editPlus and Notepad++.
After you finish the Package and Modifiers, use Eclipse.