Executing a Jar on Vista with a double click

為{幸葍}努か 提交于 2019-11-26 09:28:44

问题


This pretty much has me defeated.

On XP and earlier versions of Windows you could customise Open With filetypes to include java - jar \"myjar.jar\", but on Vista this functionality seems to have been removed. I can of course create a .bat file to launch my application, but is it possible to make Vista execute a .jar as required?


回答1:


You can do it from the command line with 2 utilities.

The first one, ASSOC, is used to create a file association. To verify if there is one defined for JAR type :

>assoc .jar
.jar=jarfile

If not found then create it with :

>assoc .jar=jarfile

The next step is to define the association. This is done with FTYPE.

To verify if one is already defined , type

>ftype jarfile
jarfile="C:\Program Files\Java\jre1.5.0_10\bin\javaw.exe" -jar "%1" %*

Again if not found or the wrong JRE is used, use FTYPE to fix the problem

>ftype jarfile="C:\Program Files\Java\jre1.5.0_10\bin\javaw.exe" -jar "%1" %*



回答2:


Use the software JarFix >= 1.1.0 . There is Vista support included and it "recovers" the .jar association!

download for example here: http://www.softpedia.com/get/Others/Miscellaneous/Jarfix.shtml



来源:https://stackoverflow.com/questions/354664/executing-a-jar-on-vista-with-a-double-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!