First knowledge of Java: write a Java program with Notepad

1. Preliminary knowledge

To write a code using Notepad, you need to install JDK (Java Developer Tools) and configure environment variables.

JVM is a software implemented with C/C++ code, called Java virtual machine. 

We installed JDK, the reason why JVM appears because JDK contains JVM

 2. Write a simple program

1. Write a program using Notepad

Create a new text document and change the suffix to .java

Write a HelloWorld program

 

 

2. Compile the .java file 

 Click win+R, enter cmd, transfer to the file we wrote, and then use j avac+filename.java to compile

 

3. Run the .class file

 Use j avac+ file name to run in JVM

 

3. Possible problems

Not an internal command: JDK environment variables are not configured properly

No .class file is generated: no saving after writing

Guess you like

Origin blog.csdn.net/benxiangsj/article/details/128436652