Your quoting on the arguments is wrong. You have too many quotes. You need to write
ShRun.lpParameters = "Path \"C:\\Program Files\\Java\\jdk1.7.0_02\\bin\\\"";
To see that your version will fail I did the following experiment at the console:
C:\Users\heff>setx path """C:\Program Files\Java\jdk1.7.0_02\bin\""" ERROR: Invalid syntax. Default option is not allowed more than '2' time(s). Type "SETX /?" for usage.
I also note that you are using SEE_MASK_NOCLOSEPROCESS
. Normally you do that so that you can then wait on the process handle that is returned. You don't appear to be doing that. What's more, you don't appear to be closing the process handle which is your responsibility when you use SEE_MASK_NOCLOSEPROCESS
.