"Java" FAQ "Environment variable setting problem" error: unable to find or load main class "XXXXXX" __java

Source: Internet
Author: User


1, problem phenomenon


First of all, the code is absolutely free of problems.

F:\01 java\01 project\00 Connectdatabase>java operateoracle
Error: The main class operateoracle could not be found or could not be loaded


2. Solutions


This problem occurs because the path to the jar is newly added to the classpath F:\01 java\04 Libs\database-lib\ojdbc7.jar but not followed by a semicolon ";"

classpath configuration that will cause the problem :

C:\Program Files\java\jdk1.7.0_65\lib\tools.jar; F:\01 java\04 Libs\database-lib\mysql-connector-java-5.1.33-bin.jar; F:\01 java\04 Libs\database-lib\ojdbc7.jar

after adding a semicolon, the Classpath configuration that runs correctly :

C:\Program Files\java\jdk1.7.0_65\lib\tools.jar; F:\01 java\04 Libs\database-lib\mysql-connector-java-5.1.33-bin.jar; F:\01 java\04 Libs\database-lib\ojdbc7.jar;


3, Association and summary


Through this problem, the individual thinks that when all other environment variables are configured, it is advisable to add a semicolon ";" after the environment variable, so as to avoid the occurrence of the problem. Otherwise, like this, a sudden "error: unable to find or can not load the main class", and then to troubleshoot problems, it is time-consuming. That would be worth the candle. But specifically why to add a semicolon after the environment variable, this does not know what the reason, hoping to have a master pointing. Additionally, this problem can occur if the JDK's own jar file path is not configured or incorrectly configured in Classpath.



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.