http://www.oracle.com/technetwork/java/javase/downloads/index.html
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>".
Click Start, then Control Panel, then System.
Select Advanced tab, then Click Environment Variables button.
Click New button in User Variables.
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.
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.
Variable name: | |
Variable value: |
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!
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.
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.