Java compilation complete run-time error cannot find or load main class

Source: Internet
Author: User

1. The environment should be no problem, the CMD test Java and javac all pass.

Variable name classpath

The value of the variable.; %java_home%\lib;%java_home%\lib\dt.jar;%java_home%\lib\tools.jar

Variable name path

The value of the variable plus%java_home%\bin;%java_home%\jre\bin;

2. The running program should also be no problem, because it is based on not being on the basis, and has been compiled.

public class Hello

{

public static void Main (string[] args)

{

System.out.println ("Hello world!");

}

}

Problem solving:


Java Hello//Do not add suffixes when running!

Specific reasons: grammar rules. Run, just Java hello, do not add the. java suffix after hello. If added, the compiler will go to find Hello.java.class files, but in fact you are hello.class files, will naturally find AH. See clearly Javac Hello.java, compile is to add suffix name, java Hello explanation is not need to add suffix name.

Java compilation complete run-time error cannot find or load main class

Related Article

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.