Java environment variable configuration--resolve "cannot find or load main class"

Source: Internet
Author: User

The system has recently been re-installed. All of the experience of the poisoning of the plate is painful!! After the JDK has been installed successfully, after configuring the environment variable to write a HelloWorld test there is no problem, but when you hit a container example, the following problem occurred.


problem Recurrence:



The strange thing is that I didn't have a problem with the last example. After you have determined that it is not a spelling problem, start the Baidu this cannot find or load the main class problem.




Problem Resolution steps:


1. Reconfigure the 3 environment variables in the following order:

    • Java_home=d:\java
    • Classpath=.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;
    • path=.;  %java_home%\bin;  


Click to open: Computer Right Button "Properties"-"Advanced system Settings"-"Advanced"-"Environment Variables"-"(System variable s) new" (if you already have this environment variable, add a semicolon in the English state, continue to write down the line)



2. Restart cmd Command Window

3. Re-enter the command (execution succeeded →→)



What system environment variables:


Environment variables (environment variables) are typically used in the operating system to specify the operating system environment of some parameters, such as: temporary folder location and System folder location.

An environment variable is an object with a specific name in the operating system that contains the information that one or more applications will use. For example, the PATH environment variable in Windows and DOS operating system, when the system is required to run a program without telling it the full path of the program, in addition to the current directory in the search for this program, but also in path specified in the path to find. The user can run the process better by setting the environment variables.



Java environment variable configuration--resolve "cannot find or load main class"

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.