How to install Java on Windows systems: Easy-to-follow tutorial, requires specific code examples
Java is a widely used programming language, whether in development Java plays an important role in applications and the use of various software. Installing Java on Windows systems is easy, and this article will provide you with an easy-to-follow tutorial, including specific code examples.
Step 1: Download the Java installation package
First, you need to download the Java installation package. Visit Oracle's official website (https://www.oracle.com/java/technologies/javase-jdk15-downloads.html) and find the Java installation package for Windows systems.
Step 2: Run the installation package
After the download is completed, double-click to run the Java installation package, and an installation wizard will appear on your screen.
Step 3: Install Java
Follow the wizard's instructions and select the location where you wish to install Java. Normally, it is recommended to choose the default installation location.
Step 4: Set environment variables
After installing Java, you need to set Java's environment variables so that your system can find the installation path of Java. Here are the steps to set environment variables:
Step 5: Verify Installation
To verify that Java installed successfully, you can open a command prompt and enter the following command:
java -version
If you see output similar to the following , indicating that Java has been successfully installed:
java version "1.8.0_261" Java(TM) SE Runtime Environment (build 1.8.0_261-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)
At the same time, you can also run a simple Java program to verify the installation. The following is a simple sample program:
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }
You can save the above code as a file named "HelloWorld.java" and run the following command in the command prompt to compile and run the program:
javac HelloWorld.java java HelloWorld
If you see the output of "Hello, World!", then congratulations, Java has been successfully installed and can run normally.
Summary
Installing Java is very simple, just follow the above steps to download, install and set environment variables. After verifying the installation, you can use Java to develop various applications or run other Java-based software. Hope this article helps you!
The above is the detailed content of Java Installation Guide on Windows Systems: A Simple and Clear Tutorial. For more information, please follow other related articles on the PHP Chinese website!