In Windows 7, you cannot double-click to open the jar file.

Source: Internet
Author: User

Address: http://blog.csdn.net/zhangkaihang/article/details/7684500

There are two types of jar files after Java packaging.

1. A single jar package, for example, the database vendor driver used in the project, you can use the class in the package to import the jar package using eclipse.

2. Java is packaged into executable GUI applications.

In Windows 7, you cannot double-click to open an executable GUI application packaged in Java.

Sometimes the open method of the JAR file is always associated with the compression software. At this time, we have to re-associate it with the JVM virtual machine.

Of course, we can use Java-jar *. jar in the command line to execute (* indicates the JAR file name)

I. Solution: in Windows 7, you cannot double-click to open the jar file.

Modify the registry key and set hkey_classes_root \ applications \ javaw.exe \ shell \ open \ command

Change the data value to "D: \ Program Files \ Java \ jdk1.6.0 _ 21 \ JRE \ bin \ javaw.exe"-jar "% 1"

(You only need to add-jar to the original value ). For example:



Note 1: Some people can right-click the open method of the JAR file and select the default program to locate javaw.exe in JRE \ bin, but it still cannot run, this is because the-jar parameter is missing in the Command executed during double-click. In Windows 7, you can only modify the registry. Windows XP does not have to be so troublesome. The solution in Windows XP is attached below.

NOTE 2: after the experiment, the JAR file name cannot be Chinese.

Ii. Solutions in Windows XP

Procedure:

1. Tools -- Folder Options -- file type


2. If there is no jar, create a new extension. If there is an extension, modify it.

3. Click create.

4. the "advanced" button appears in the "edit file type" window.

Click "New (n)..." to display the "New Operation" window. Name the operation "open ",

The application executing the operation is "D: \ Java \ jdk1.6.0 _ 12 \ JRE \ bin \ javaw.exe-jar % 1 ".

(Note: D: \ Java \ jdk1.6.0 _ 12 is the JDK Directory, which is set based on the actual environment on the PC .)




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.