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 to solve the prompt problem of "file not found" when cmd runs java program

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

Share

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

This article mainly introduces "how to solve the" prompt problem "that the file cannot be found in cmd running java program. In the daily operation, I believe that many people have doubts about how to solve the problem of" file not found "in cmd running java program. The editor consulted all kinds of materials and sorted out simple and useful operation methods. I hope it will be helpful for you to answer the doubt that "how to solve the problem that cmd runs the java program" and cannot find the file "prompt problem"! Next, please follow the editor to study!

Generally speaking, when we run java code and the runner has such a problem, it means that our current path is not the java file storage path.

Step 1: we need to find the folder where we store our java code, type "cmd" in the "search" bar above, and enter directly.

Step 2: pop up the Command prompt and we will know that the path on our Command prompt will be the same as the path where our java code is stored.

Step 3: we enter the following code according to the name of the java file we saved, and print our code as follows:

Enter javac Hello.java for the first time, and then enter

Enter java Hello for the second time and enter directly.

Step 4: then the java code we wrote will be printed out.

1. / 3 method / step 2

The first step: we directly click on our computer "start", find the "attachment", in the "attachment" to find the "command indicator", click to enter, then we will find that our path is inconsistent, if we continue to run, it will always report an error, saying that the file path can not be found.

Step 2: we need to enter cd from the keyboard, enter our drive letter and the name of the folder where our java is stored, then enter, and then continue to enter the drive letter we have stored, and continue to enter. At this time, we will find that our path is correct, consistent with the path where we store the java code, as shown in the following figure

Step 3: then we type from the keyboard as above:

Enter javac Hello.java for the first time, and then enter

Enter java Hello for the second time and enter directly.

At this point our java code is printed out.

At this point, the study on "how to solve the cmd running java program" cannot find the file "prompt problem" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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