Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
268 views
in Technique[技术] by (71.8m points)

java - Executing a Jar on Vista with a double click

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 FilesJavajre1.5.0_10injavaw.exe" -jar "%1" %*

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

>ftype jarfile="C:Program FilesJavajre1.5.0_10injavaw.exe" -jar "%1" %*

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...