@ (Error) could not find the main class, program would exit (resolved)

Source: Internet
Author: User

Original @ (Error) could not find the main class, program would exit (resolved)

 

(Sorry, if you want to see the picture or the text on it more clearly, you can hold down CTRL and then scroll up the mouse wheel.) To change back the same way scroll down can,)

--------------------------------------------------------------------

Today 2011.4.20:This article is I just contact myeclipse when write, a year passed, feel mature point, this article is still a little insufficient, so fill up. -------------------------------------------------A piece of code that works well in JCreator, in MyEclipsealways appears could not find the main class,program would exit. This is enough to explain the code is correct, is the problem of the program. the reasons and solutions are as follows:because the Java class file that we compiled with the higher version of the JDK attempts to run on the lower version of the JVM, the reported error. Because the class file generated by the higher version of the JDK uses a format that may be different from the. class file format of the lower version of the JDK. This way, the lower version of the JVM cannot explain that executing this. class file throws could not find the main Class.program will exit does not support the class version error. This error is particularly noticeable in versions prior to JDK5 and JDK5. Because JDK5 has made a lot of enhancements to the Java syntax, introducing some elements of the new. class file, causing the older JVM to fail to interpret and execute the. class file. Even though this class does not use any new elements of JDK5, the. class file generated by JDK5, JDK1.4, and its previous JVM are unrecognizable. Workaround:1. Find out which JDK version of the program was developed (JDK should not be unfamiliar to Java learners)2. In the MyEclipse menu->windows->proferences->java-> installs JREs re-set the JDK path to the JDK version (e.g.) when developing the program (I'll do it!). My eclipse is 7.0,jdk is 6u13. ) 3. Windows->proferences->java->compiler, set the Compiler compliance level to the same JDK as above (for example, If you were to download the JDK today in 2011, it's probably 1.6, and it's recommended to tick 1.6.-----------------------------------------------------------------------------for the project, sometimes the version issue is also related to the compilation level, then modify it (for example) Solve this problem may need to thank it, is it gave me inspiration,: http://blog.bj50.net/shabby/

@ (Error) could not find the main class, program would exit (resolved)

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.