Home arrow static arrow Java Programming [Archive] - Why can't excute a .jar file by dble-clicking?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Why can't excute a .jar file by dble-clicking?
This topic has 3 replies on 1 page.

Posts:4
Registered: 04-6-24
Why can't excute a .jar file by dble-clicking?  
Aug 2, 2004 11:23 PM



 
I'd like to ask why I can't excute a .jar file by double-clicking the .jar file icon, while it do work when I excute the command "java -jar file.jar" at my win2k command prompt.

The manifest file in my .jar file is as following:
Manifest-Version: 1.0Main-Class: study.Test
 

Posts:8,813
Registered: 10/4/00
Re: Why can't excute a .jar file by dble-clicking?  
Aug 3, 2004 12:02 AM (reply 1 of 3)



 
In windows for you to be able to double click on any type of file, you need to associate a program with that extension. if you associate
"C:\jdkxxxxxx\bin\javaw.exe" -jar "%1"
with a jar, windows will know how to handle it. If you are running some other OS, I have no idea.
 

Posts:4
Registered: 04-6-24
Re: Why can't excute a .jar file by dble-clicking?  
Aug 3, 2004 2:06 AM (reply 2 of 3)



 
bbritta, thank you so much for replying. It works now.
But there's still an question. what does "%1" mean?
 

Posts:3,183
Registered: 10.09.03
Re: Why can't excute a .jar file by dble-clicking?  
Aug 3, 2004 2:35 AM (reply 3 of 3)



 
in the old dos - batch files, %1, %2, etc. referred to the parameter. So if you would do something like :

mybatchfile param1 param2


then %1 would be param1 en %2 would be param2.

I guess the same is still possible in windows.
 
This topic has 3 replies on 1 page.