Home > Java > javaTutorial > body text

Windows double-click the jar to make it executable

黄舟
Release: 2017-01-18 15:12:38
Original
1823 people have browsed it

Java Programming Language

Java is an object-oriented programming language that can write cross-platform application software. It is a Java programming language and Java platform launched by Sun Microsystems in May 1995. (That is, the general name of JavaEE(j2ee), JavaME(j2me), JavaSE(j2se)).


Background: Others have installed jdk and configured environment variables on the Alibaba Cloud server. When I placed the jar package on the remote server, it became a compressed package. Tangled………………

Windows double-click the jar to make it executable

#First of all, check whether the problem is caused by the development computer and server jdk version. After java -version, it was found that the server is 1.7 version, tested on another laptop with 1.7jdk installed. Follow the reference experience (the last step is not used) and select the default opening method as the javaw.exe file under jre\bin, and you can open the interface directly. The effect is as follows:

Windows double-click the jar to make it executable

Second, check the environment variables and files on the server side

The java_home, classpath, and path settings on the server side are all correct, but the file lacks the corresponding version jre, the same version of jre is also used in the reference, not the jre in jdk, try this now.

Windows double-click the jar to make it executable

Third, modify the default opening method

Select serverchat.jar, right-click and select [Open with], [Select the default opening program], [Browse] , pay attention to the path, select the javaw.exe file in jre under jdk, open it and confirm. At this time, serverchat.jar will display the java icon. Some computers can open it by double-clicking it. However, if the interface cannot be opened by double-clicking, continue to the next step.

Windows double-click the jar to make it executable

Windows double-click the jar to make it executable

Fourth, modify the registry of the javaw.exe command under root permissions

This step is also critical. I have referred to other people's blog posts to carry out this step. I used the regedit command directly without using [Open as Administrator]. The java.exe and javaw.exe folders in the registry were both empty.

To start, enter regedit in the search bar, regedit.exe will appear, select the command, right-click and select [Run as administrator], as shown in the figure below.

Windows double-click the jar to make it executable

In the registry editor, find "HKEY_CLASSES_ROOT\Applications\javaw.exe\shell\open\command", select [Default], and right-click [Modify].

Windows double-click the jar to make it executable

Edit to the following statement:

"C:\Program Files\java\jdk1.7.0_67\jre\bin\javaw.exe" -jar "%1"
Copy after login

Save and exit to achieve the second picture running effect.

In addition, we can use the command line to run the jar package. Even the compressed jar file can complete the operation, but it is not conducive to graphical operations.

java -jar C:\Users\***\Desktop\ServerChat.jar
Copy after login

The above is the content of Windows double-clicking the jar to be executable. For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template