10-28-2013 02:17 PM - edited 10-28-2013 02:45 PM
In my code, I am setting my target path to be:
C:\WINDOWS\system32\java.exe -jar C:\MyApp\MyExe.exe
I am trying to do what I believe is called 'setting a PATH variable', to designate that the program will be running a jar file from java. When the shortcut is created, the Target Path in the shortcut results in:
"C:\WINDOWS\system32\java.exe -jar C:\MyApp\MyExe.exe"
and WinXP says that it doesn't recognize the path, and the shortcut doesn't work. If, however, in the shortcut, I remove the leading ", so that it looks like:
C:\WINDOWS\system32\java.exe -jar C:\MyApp\MyExe.exe"
the shortcut will work just fine.
How can I use your method to modify my Target Path in my code so that the resulting Target in the shortcut will be:
C:\WINDOWS\system32\java.exe -jar C:\MyApp\MyExe.exe" or C:\WINDOWS\system32\java.exe -jar C:\MyApp\MyExe.exe
Thanks for your help.
10-28-2013 05:22 PM
You are executing "java.exe" with the arguments "-jar C:\MyApp\MyExe.exe".
Did you try just having C:\WINDOWS\system32\java.exe in the TargetPath
and then adding -jar C:\MyApp\MyExe.exe as the first element in the Arguments array?
To make it work with variations of the windows operating system you should define the target path as %SystemRoot%\system32\java.exe
That way it will find the system path regardless of which drive letter is the system root and if it is C:\Windows or C:\WINNT etc.
10-28-2013 05:56 PM
Yes. I had thought of putting C:\WINDOWS\system32\java.exe in the TargetPath and then adding -jar C:\MyApp\MyExe.exe as the first element in the Arguments array right after my recent post, and it seems to work.
I will try using the %SystemRoot%\system32\java.exe as well.
Thank you very much for your help.
07-26-2021 06:18 PM - edited 07-26-2021 06:19 PM
07/26/2021 - kudos to Troy Kujawski
I just used this as I needed a programmatically generated shortcut on my windows 10 desktop.
This method works still!
I used the "Get System Directory" VI to push in the proper windows 10 desktop path for my user into the desktop path and this worked perfectly!
02-19-2024 05:51 AM
Thanks Troy!
This still works fine in Windows 11.
Just in case anyone else comes across it.