Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How java compiles and runs

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to compile and run java". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The method of opening a command prompt in the folder where it is located

Click on the File option in Explorer, and you can see the command prompt (if not, powershell is fine).

Create a new text document under this folder, write cmd.exe in it, and then change the document to the .bat suffix.

Clear the path bar and fill in cmd, and press enter to determine.

Hold down shift and right-click, and there is a command prompt in the pop-up menu (if not, powershell is fine).

Open cmd in the usual way, and then move to the appropriate folder with the cd command.

Compile the java source code using javac

Javac Java source code. The Java source code can use either a relative path or an absolute path, and the file can be compiled directly after moving the cmd to the appropriate folder. For example: javac timeDate.java.

Note: when using javac, Java source code needs to be suffixed with .java.

Run the compiled class file using java

The binary file compiled by java javac. Java binaries can use either a relative path or an absolute path, and after moving the cmd to the appropriate folder, you can run the file directly. For example: java timeDate.

Note: when using java, Java binaries do not need the suffix .class.

Compile and run using the integrated development environment

If you use the integrated development environment for java development, compilation and running have been encapsulated into functions, and there are build and run buttons on the compilation toolbar in the upper right corner (build, which means to recompile the entire project).

That's all for "how java compiles and runs". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report