Reputation: 31
I have written a Jar file which opens a file. This Jar is associated with the extensions .jbz and .jbr. What my program needs is the full file name of the file in order for the program to open it.
Windows 7 appears to have lost the additional Run With options that Windows XP had and I'm not quite sure how to pass the file name as an argument in a batch file.
The desired end result is just double clicking a file and having my Jar run with that file as arg[0].
Upvotes: 2
Views: 1524
Reputation: 1
Create a .bat file in the same folder as your jar file. Put in the following lines:
java -jar "%0\..\jarFile" "%1"
where jarfile is your .jar file.
Now, when you right click on your .jbz or .jbr file you can select the .bat file as the "opener".
Upvotes: 0
Reputation: 31
Turns out that %1 is the file name and path of the file you tried to open.
java.exe -jar jarFile %1
Upvotes: 1