Trying to run a jar from PHP

前端 未结 3 1868
梦毁少年i
梦毁少年i 2021-01-28 08:16

After reading some of the posts in this website related to exactly the same issue I\'ve got, I found that none of them were giving me a successful result:

How to run a j

3条回答
  •  情话喂你
    2021-01-28 08:21

    You have to do something like this:

    //REPLACE THIS PATH WITH THE REAL JAVA PATH
    $handle = popen(`"C:\\Program Files (x86)\\Java\\jre7\\bin\\java.exe arguments"`, "r"));
    //You can read with $read = fread($handle, 2096)
    pclose($handle);
    

    exec will not work on Windows (for "external" executables) and in most cases you'll have to provide the full path to Java.

提交回复
热议问题