I try to execute a java swing jar with a JFrame from a webapp like this :
Process p = Runtime.getRuntime().exec("java -jar my_swing_app.jar");
My app starts (logs are ok) but my jframe doesn't appear. When I run the swing app with powershell, there is no problem.
I try to execute this jar in a java web application that runs in Wildfly server.
Any idea ? Thx.
UPDATE
I tried with another command (without java swing app) :
Process p = Runtime.getRuntime().exec("cmd /c start C:\\test\\build.bat");
The result is the same. I can see the process on the windows process list (build.bat) but the command prompt doesn't appear.
The problem is the 'java -jar my_swing_app.jar' is getting interpreted as a single command. Instead try
String[]cmd={nativeConverterCommand,tmpHtmlFilePath,tmpPDFFilePath};
Process wkhtmltopdf=Runtime.getRuntime().exec(cmd);
Refer javadoc
The first string is the command, the 2nd and third arguments.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.