search
HomeJavaJavagetting StartedHow to run java program

Method: 1. Create a new java file containing program code in the desktop; 2. Open cmd and execute the "cd Desktop" command to enter the desktop; 3. Execute the "Java file name.java" command to compile; 4. Execute the "java file name" command to run the java program.

The operating environment of this tutorial: windows7 system, java10 version, DELL G3 computer.

To run a java program, we must first write a java program. Since what we are talking about here is just the running of the java program, I will start with a simple program!

1. Open your own notepad and enter the following code:

import java.util.*;
public class HelloWorld{
  public static void main(String[] args){
    System.out.println("HelloWorld");
    }
}

How to run java program

##Select file---->Save as

File name: HelloWorld.java

File type: all files

[Remember where your files are saved here]

How to run java program

For convenience, I saved my first java program on the desktop.

2. Open the attachment --->Command Prompt

Type [cd Desktop] and press [Enter key]

[This step is to enter the desktop. That is the location where you save the file]

How to run java program

3. Type [javac HelloWorld.java]

[This step is to compile your own java program]

How to run java program

4. Type [java HelloWorld]

[This step is to run your own java program]

Then you can see the running results Got it!

How to run java program

Recommended: "

java video tutorial"

The above is the detailed content of How to run java program. For more information, please follow other related articles on the PHP Chinese website!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.