I use Windows. I want to use QProcess in a running jar app (java/javaw). After starting that, open the cmd to show me information about working my jar app.
My problem is: when I exec my qt code, the Java app starts (in the background), but cmd doesn't open with the Java runtime.
My code:
QProcess process;
process.setWorkingDirectory("D:\\Programs\\Qt\\Units\\MyJavaProjects\\StackExp\\target");
process.setProgram("java.exe");
process.setArguments({"-jar","StackExp-1.0-SNAPSHOT.jar"});
process.start();
process.waitForFinished (-1);
if (!process.waitForStarted())
{
qDebug() << "1: " +process.readAllStandardOutput();
qDebug() << "2: " +process.readAllStandardError();
qDebug() << "The process didnt start" << process.error();
}
My jar app built in maven and it has type: Java Application.
I use java.exe
and javaw.exe
, both runtimes don't open cmd.
How can I exec jar app with QProcess or otherwise, and at the same time open cmd for see information about working jar app?