Double-click the jar file to show the solution for could not find main class

Source: Internet
Author: User
Please ensure that there is at least one main method entry and a graphical interface in the jar package before viewing this article.
and ensure that the Main-class in the Meta-inf/manifest file has pointed to the previously implemented Main method portal.

The hard drive has been damaged recently, so the OS was reinstalled and a copy of the JDK or JRE (not installed version) was found and cannot be opened for JAR file Execution (JDK version 1.6_11).
So in the open way to point to the JAVAW program, found invalid, and prompted "Cannot find main class", while Windows to the jar type of files associated with the designated JAVAW program, the internet found a pass, no one mentioned the solution to the problem, And obviously the problem is not caused by the problems mentioned in the opening paragraph.
The definition of the current jar type is removed from the current user configuration in the registry. But after a retry, it still does not work.

The JDK was reinstalled so that the jar file could be opened this time, and the program used to open it was still javaw from the open way. There is no difference between the definitions of file types in the registry. From the folder option-> file type to see the difference at last, the high-level inside the open operation is defined as follows:
"C:\Program Files\java\jre6\bin\javaw.exe"-jar "%1"%*
And if we choose Javaw by ourselves, the default open action has no-jar parameter and must be added manually.
We know that the Java Boot jar package parameters are-jar, but remember that the previous JAVAW can directly open the jar, I do not know when the need to have-jar parameters.

So for a copy of the green JRE, just change the definition of open to solve the problem above.

Solve the above problems, and created a new problem, the previous choice to open the JAVAW program in the open way to lose, more redundant, this can be modified in the registry
The program that finds the response under Hkey_classes_root\applications can be deleted, and every time you open a file with one program windows will be
This place in the registry leaves relevant records.

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.