I have some code to run java.exe with command line to launch a game. Since I don't players launch more than one game program instance at same time, so I need to check whether the game has been running or not.
For normal exe file, I can get exe path from process information. But for java game, the execute file path is always the java.exe
or javaw.exe
's path. So I have thought to get the command line information to get the jar file running. But there is the reason why I can't get the command line:
Remember that from Win32's point of view, the command line is just a string that is copied into the address space of the new process. How the launching process and the new process interpret this string is governed not by rules but by convention.
So, I need another way to do such thing, but I can't thought out any method to distinguish two java process. Anyone could give me some tips?