Home > Java > javaTutorial > Java Installation Guide on Windows Systems: A Simple and Clear Tutorial

Java Installation Guide on Windows Systems: A Simple and Clear Tutorial

王林
Release: 2023-12-28 15:40:13
Original
1442 people have browsed it

Java Installation Guide on Windows Systems: A Simple and Clear Tutorial

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:

  1. Open "Control Panel" and select "System and Security".
  2. In the "System" column, click "Advanced System Settings".
  3. In the new window, click the "Environment Variables" button.
  4. In the "User Variables" column, click "New".
  5. In the "Variable Name" field, enter "JAVA_HOME", and in the "Variable Value" field, enter the installation path of Java, for example: "C:Program FilesJavajdk1.8.0_261".
  6. In the "System Variables" column, find the "Path" variable and add "%JAVA_HOME% in;" at the end of its value.
  7. Click "OK" to save your changes.

Step 5: Verify Installation
To verify that Java installed successfully, you can open a command prompt and enter the following command:

java -version
Copy after login

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)
Copy after login

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!");
   }
}
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template