QProcess not starting the Java Application
-
Dear Friends,
I am trying to start the java application from QProcess. it is starting the application but only in task manager i can see that application. basicly is is not showing but running.
This is the codeQString originalPWD = QDir::currentPath(); QProcess *processStart = new QProcess(); processStart->setWorkingDirectory(getGpsClientExePath()); QString filePath = processStart->workingDirectory() + QDir::separator() + "gps.start.exe"; QDir::setCurrent(processStart->workingDirectory()); bool started = processStart->startDetached(filePath);
filepath is correct.if i double click on .exe then its starting the application also.So i dont understand why QProcess unable to start the application or show .Any lead will be appreciated.
TIA -
Dear Friends,
I am trying to start the java application from QProcess. it is starting the application but only in task manager i can see that application. basicly is is not showing but running.
This is the codeQString originalPWD = QDir::currentPath(); QProcess *processStart = new QProcess(); processStart->setWorkingDirectory(getGpsClientExePath()); QString filePath = processStart->workingDirectory() + QDir::separator() + "gps.start.exe"; QDir::setCurrent(processStart->workingDirectory()); bool started = processStart->startDetached(filePath);
filepath is correct.if i double click on .exe then its starting the application also.So i dont understand why QProcess unable to start the application or show .Any lead will be appreciated.
TIA@Sebastian said in QProcess not starting the Java Application:
gps.start.exe
You're saying "gps.start.exe" is a Java application?
If so, could it be possible that "java" command is not available in path to your QProcess...?
Maybe you may want to look at QProcessEnvironment class to be sure the environment for QProcess is the right one you need -
Hello @Sebastian
Are you positive your path is OK? Maybe the path you are giving is wrong and therefore it cannot find the app. Also as @Pablo-J-Rogina said it could be the java path is not found.Try using QDir directly instead using QString.
QString filePath= QDir::currentPath ().absoluteFilePath ("gps.start.exe");
This will ensure your path is properly formed.If your gps.start.exe does not exist in that location and if your environment has a path set, then just use the name and leave off the path.
processStart->startDetached ("gps.start.exe");You can also just use the static method QProcess::startDetached (...); (no sense wasting memory when you can use a static method)