I am new to creating Custom URI Schemes and I am trying to launch an executable jar file using URI Schemes in my Windows 7 system.
For running this jar file from command prompt, I use this command:
java -jar demo.jar
For launching the same using the Custom URI Scheme, I created a
.reg file with the below entry (Copied from the below post):
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\DemoStart] "URL Protocol"="" [HKEY_CLASSES_ROOT\DemoStart\shell] [HKEY_CLASSES_ROOT\DemoStart\shell\open] [HKEY_CLASSES_ROOT\DemoStart\shell\open\command] @="\"java.exe\" -jar \"C:\\Users\\John\\Desktop\\demo.jar\""
This does not works for the following reason:
The executable jar file which I am trying the run named
demo.jar is a third party provided jar file and it has quite a few dependencies on XML config files which are also located in the same folder containing the jar file. I don't have privilege to change any code present within the jar file.
Using command prompt, the command
"java.exe" -jar "demo.jar" works only when I navigate to the folder containing both the
demo.jar as well as the
dependent config xml files. BUT if I try to run the command:
"java.exe" -jar "C:\Users\John\Desktop\demo.jar" from the default location of the command prompt window (which in my case is
C:\Users\John) then the command does not work since the dependent config xml files are not available.
Hence I need to find out a way of changing the default location of the command prompt as well before executing the jar file.
Please suggest whether it is possible to set the command prompt default location to
C:\Users\John\Desktop when I trigger the custom URI (In that case no need to navigate to a different location and the command should work fine).