双击在Vista上执行Jar [英] Executing a Jar on Vista with a double click
问题描述
这几乎让我失败了。
在XP和早期版本的Windows上,您可以自定义Open With filetypes以包含java-jarmyjar.jar,但是在Vista上,这个功能似乎已被删除。我当然可以创建一个.bat文件来启动我的应用程序,但是可以根据需要让Vista执行.jar吗?
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?
推荐答案
您可以使用2个实用程序从命令行执行此操作。
You can do it from the command line with 2 utilities.
第一个ASSOC用于创建文件关联。要验证是否为JAR类型定义了一个:
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
下一步是定义关联。这是通过FTYPE完成的。
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" %*
如果未找到或使用了错误的JRE,请使用FTYPE解决问题
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" %*
这篇关于双击在Vista上执行Jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!