1 Reply Latest reply on Apr 2, 2014 9:14 PM by TPD-Opitz

    ProcessBuilder Environment the right way?




      I have a call to a Java program that works on the windows7 command line:

      d:\temp\test>"c:\progam files\java\java1.6\bin\java.exe" -cp subdir\main.jar package.of.MyMainClass


      I need to execute this from another Java CLI application.

      When calling the other App I am in the same working directory. This other application has its starter jar in the working dir and other jars in the same subdir. My Code is in a jar file in this subdir included in the starter apps classpath.


      my code is:

      ProcessBuilder processBuilder = new ProcessBuilder(Arrays.asList(
         "c:\progam files\java\java1.6\bin\java.exe",
       processBuilder.directory(new File(".").getAbsoluteFile().getParentFile());
      Process process = processBuilder.start();



      new File(".").getAbsoluteFile().getParentFile()

      resoves to the working dir.


      I get This error:


      Java Virtual Machine Launcher


      Could not find the main class: de.contiteves.application.ParameterGuiStart.  Program will exit.





      Why does my program run from the command line directly but  not when executed byProcessBuilder?