Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QProcess not starting the Java Application

QProcess not starting the Java Application

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 586 Views
  • 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 Offline
    S Offline
    Sebastian
    wrote on last edited by
    #1

    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. RoginaP 1 Reply Last reply
    0
    • S Sebastian

      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. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @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
      2
      • BuckwheatB Offline
        BuckwheatB Offline
        Buckwheat
        wrote on last edited by
        #3

        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
        0
        • S Offline
          S Offline
          Sebastian
          wrote on last edited by aha_1980
          #4

          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
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved