The workaround for the main class cannot be found or cannot be loaded when running a Java file under cmd

Source: Internet
Author: User

Recently read Java, but a seemingly very basic hellorworld headache for more than 10 minutes, Baidu a bit, if you edit and run under CMD. java file times wrong, the solution is as follows:

D. Java files under the packing directory.

Open cmd and enter the D packing directory for Javac Demo.java,:

This step is not error, because as long as your classpath setup success, there will be no error problem,

At this point we see that the Demo.class just compiled has already appeared in the root directory.

When we proceed to the next step, we will find a cmd error:

Believe that a lot of students have just started to meet this problem, Baidu check up time and effort, and sometimes many people write the solution will not solve the problem at all.

Then we go directly to the dry goods, this kind of problem arises, is often caused by incomplete configuration of classpath.

in the classpath of the environment variable, the value of the variable is prepended. When you are sure, rerun cmd to resolve the problem :

As for how to configure the environment variables, please see my previous Java perfect configuration strategy.

The workaround for the main class cannot be found or cannot be loaded when running a Java file under cmd

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.