Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved QProcess not starting the Java Application

    General and Desktop
    3
    4
    412
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Sebastian last edited by

      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 code

          QString 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

      Pablo J. Rogina 1 Reply Last reply Reply Quote 0
      • Pablo J. Rogina
        Pablo J. Rogina @Sebastian last edited by

        @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

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        1 Reply Last reply Reply Quote 2
        • Buckwheat
          Buckwheat last edited by

          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)

          Dave Fileccia

          1 Reply Last reply Reply Quote 0
          • S
            Sebastian last edited by aha_1980

            Thanks All Guys,
            My code was correct to start the application.The Problem was from java side code. So I Marked it as resolve.

            1 Reply Last reply Reply Quote 1
            • First post
              Last post