I am using a C++ application to launch another process. This process happens to be java so I need to run javaw.exe. However I want my application to work on any windows system with a compatible java version installed and in the windows search path.
I am launching my process with CreateProcess, however the first argument requires the FULL path of the executable and does not search the windows search path.
I would like to find the full path of the javaw.exe from the windows search path in my CPP code to then pass to CreateProcess so that I can appropriately start and later, via TerminateProcess. Stop the external program.
How do I find the full path of javaw.exe via windows search path?
Edit: this question is different. than the referenced duplicate because my specific question is to use the windows search path (which btw does includes the local directory, the PATH env, and some standard locations). And I want to do this via CPP specifically. I specifically want to use the windows search path system since users may have more than one javaw.exe and I want which one is used to be predictable via windows standard search paths and not a custom search method I implement.