When configuring environment variables, CMD runs java-version, error: The main class cannot be found or cannot be loaded-version

Source: Internet
Author: User

This aspect applies to the error: Java can not find or load the main class, generally cannot find the path of the class, the problem is on the CLASSPATH environment variable, of course, this is the majority of large probability of the error point

Do not rule out according to personal circumstances, so think of the great leader Chairman Mao's words: Specific problems specific analysis

1, the entire configuration environment process, no longer repeat, please follow the following blog configuration (I think a very full article)

Http://www.cnblogs.com/liuhongfeng/p/4177568.html

2. Check whether the environment variable is configured successfully

Run cmd input java,javac, java-version (space between Java and-version)

(1) Java

(2) Javac

(3) Java-version

The first two--java/javac--can be output normally as a tutorial, but:
Input: Java-version Error
----------------------------------------------------------------------
Error: The main class could not be found or could not be loaded-version
Reason: java.lang.ClassNotFoundException:-version
-----------------------------------------------------------------------

3, solve java-version error problem

(1) Under System variables, create a new classpath variable and add

. ; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;

Remember: start.; End add;

Restart cmd for next run, and then Run Java-version

(2) If not, then try adding an identical classpath to the system variable as well

If you have any questions, please leave a message.

JAVAC  DetailXBasic TranslationN. java compiler ProgramNetwork explanationJavac: Compiler Javac HelloWorld: OK

When configuring environment variables, CMD runs java-version, error: The main class cannot be found or cannot be loaded-version

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.