Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8290073

Path processing does not work properly when running ProcessBuilder in CMD /c

XMLWordPrintable

    • x86_64
    • windows_10

      ADDITIONAL SYSTEM INFORMATION :
      Windows11 Pro(64bit)
      JDK 8u333 (32bit)
      Eclipse 2018-9

      A DESCRIPTION OF THE PROBLEM :
      When executing CMD / C from ProcessBuilder in the Webstart environment of Jdk 8u333, path processing does not work properly.
      \ Will be included in the first letter.
      Until JDK 8u202, the current status of k has not occurred.

      Inspection result

       1.It does not work in the webstart environment of JDK 8u333. It was

      Java Web Start 11.333.2.02
      使用中のJREのバージョン1.8.0_333-b02 Java HotSpot(TM) Client VM
      JRE有効期限: 22/08/19 0:00
      console.user.home = C:\Users\<user>
      ----------------------------------------------------
      java.version) : 1.8.0_333
      OS名(os.name) : Windows 11
      OS名(os.arch) : x86
      OS名(os.version): : 10.0
      JAVA.home : C:\Program Files (x86)\Java\jre1.8.0_333
      JAVA class.path : C:\Program Files (x86)\Java\jre1.8.0_333\lib\deploy.jar
      JAVA library.path : C:\Program Files (x86)\Java\jre1.8.0_333\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Java\jre1.8.0_333\bin;C:\Program Files (x86)\Java\jdk1.8.0_333\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\PuTTY\;C:\Program Files\dotnet\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\dotnet\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\ojdkbuild\java-1.8.0-openjdk-1.8.0.332-1\bin;C:\Program Files\ojdkbuild\java-1.8.0-openjdk-1.8.0.332-1\jre\bin;C:\Program Files\ojdkbuild\java-1.8.0-openjdk-1.8.0.332-1\webstart\;C:\Users\shish\AppData\Local\Microsoft\WindowsApps;;"C:\Program Files (x86)\Java\jre1.8.0_333\bin";.
      Runtime totalMemory : 510066688
      Runtime freeMemory : 468209808
      Runtime maxMemory : 510066688
      cmd
      /c
      "C:\Program Files (x86)\PostgreSQL\9.3\bin\pg_dump.exe" -h 127.0.0.1 -p 5432 -U postgres -F c -b -v --lock-wait-timeout=20s -f "C:\csswk\backup\webpos_pgSQL01.tar" TB_1001_20220316
      java.io.BufferedReader@9e6e76

      '\"C:\Program Files (x86)\PostgreSQL\9.3\bin\pg_dump.exe\"' は、内部コマンドまたは外部コマンド、
      操作可能なプログラムまたはバッチ ファイルとして認識されていません。
          ↓
      '\"C:\Program Files (x86)\PostgreSQL\9.3\bin\pg_dump.exe\"' is not recognized as an internal or external command,
      operable program or batch file.

      --
       2.It works fine in the webstart environment of JDK 8u202.

      Java Web Start 11.202.2.08 x86
      使用中のJREのバージョン 1.8.0_202-b08 Java HotSpot(TM) Client VM
      ユーザーのホーム・ディレクトリ = C:\Users\shish
      ----------------------------------------------------
      java.version) : 1.8.0_202
      OS名(os.name) : Windows 10
      OS名(os.arch) : x86
      OS名(os.version): : 10.0
      JAVA.home : C:\Program Files (x86)\Java\jre1.8.0_202
      JAVA class.path : C:\Program Files (x86)\Java\jre1.8.0_202\lib\deploy.jar
      JAVA library.path : C:\Program Files (x86)\Java\jre1.8.0_202\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Java\jre1.8.0_202\bin;C:\Program Files (x86)\Java\jdk1.8.0_202\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\PuTTY\;C:\Program Files\dotnet\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\dotnet\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\ojdkbuild\java-1.8.0-openjdk-1.8.0.332-1\bin;C:\Program Files\ojdkbuild\java-1.8.0-openjdk-1.8.0.332-1\jre\bin;C:\Program Files\ojdkbuild\java-1.8.0-openjdk-1.8.0.332-1\webstart\;C:\Users\shish\AppData\Local\Microsoft\WindowsApps;;"C:\Program Files (x86)\Java\jre1.8.0_202\bin";.
      Runtime totalMemory : 510066688
      Runtime freeMemory : 475840536
      Runtime maxMemory : 510066688
      cmd
      /c
      "C:\Program Files (x86)\PostgreSQL\9.3\bin\pg_dump.exe" -h 127.0.0.1 -p 5432 -U postgres -F c -b -v --lock-wait-timeout=20s -f "C:\csswk\backup\webpos_pgSQL01.tar" TB_1001_20220316
      java.io.BufferedReader@1d7a4ae
      pg_dump: 最終の組み込みOIDは16383です
      pg_dump: 拡張を読み込んでいます

      Works normally

      ---

       3.Works fine in the Eclipse-IDE environment of JDK 8u333.

      java.version) : 1.8.0_333
      OS名(os.name) : Windows 11
      OS名(os.arch) : x86
      OS名(os.version): : 10.0
      JAVA.home : C:\Program Files (x86)\Java\jdk1.8.0_333\jre
      JAVA class.path : C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\rt.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\ext\cldrdata.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\ext\jfxrt.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\ext\nashorn.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\ext\sunec.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\ext\sunpkcs11.jar;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\lib\ext\zipfs.jar;C:\pleiades\workspace\TestProcessBuild\bin;C:\pleiades\workspace\TestProcessBuild\javaws.jar;C:\pleiades\eclipse\configuration\org.eclipse.osgi\419\0\.cp\lib\javaagent-shaded.jar
      JAVA library.path : C:\Program Files (x86)\Java\jdk1.8.0_333\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Java\jdk1.8.0_333\jre\bin;C:/Program Files (x86)/Java/jdk1.8.0_202/bin/../jre/bin/client;C:/Program Files (x86)/Java/jdk1.8.0_202/bin/../jre/bin;C:/Program Files (x86)/Java/jdk1.8.0_202/bin/../jre/lib/i386;C:\Program Files (x86)\Java\jdk1.8.0_202\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\PuTTY\;C:\Program Files\dotnet\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\dotnet\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\ojdkbuild\java-1.8.0-openjdk-1.8.0.332-1\bin;C:\Program Files\ojdkbuild\java-1.8.0-openjdk-1.8.0.332-1\jre\bin;C:\Program Files\ojdkbuild\java-1.8.0-openjdk-1.8.0.332-1\webstart\;C:\Users\shish\AppData\Local\Microsoft\WindowsApps;;C:\pleiades\eclipse;;.
      Runtime totalMemory : 16252928
      Runtime freeMemory : 14416368
      Runtime maxMemory : 259522560
      cmd
      /c
      "C:\Program Files (x86)\PostgreSQL\9.3\bin\pg_dump.exe" -h 127.0.0.1 -p 5432 -U postgres -F c -b -v --lock-wait-timeout=20s -f "C:\csswk\backup\webpos_pgSQL01.tar" TB_1001_20220316

      java.io.BufferedReader@101b7af
      pg_dump: 最終の組み込みOIDは16383です
      pg_dump: 拡張を読み込んでいます

      Works normally




      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      HowToReproduce:
       start application under JNLP


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      cmd
      /c
      "C:\Program Files (x86)\PostgreSQL\9.3\bin\pg_dump.exe" -h 127.0.0.1 -p 5432 -U postgres -F c -b -v --lock-wait-timeout=20s -f "C:\csswk\backup\webpos_pgSQL01.tar" TB_1001_20220316

      ACTUAL -
      cmd
      /c
      '\"C:\Program Files (x86)\PostgreSQL\9.3\bin\pg_dump.exe\"' is not recognized as an internal or external command,
      operable program or batch file.


      ---------- BEGIN SOURCE ----------
      package test;

      import java.io.BufferedReader;
      import java.io.InputStreamReader;
      import java.nio.charset.Charset;

      public class process_test {


          public static void main(String[] args) throws Exception {
           // Process BUlter TEST CODE
      System.out.println("java.version) : " + System.getProperty("java.version"));
      System.out.println("OS名(os.name) : " + System.getProperty("os.name"));
      System.out.println("OS名(os.arch) : " + System.getProperty("os.arch"));
      System.out.println("OS名(os.version): : " + System.getProperty("os.version"));
      System.out.println("JAVA.home : " + System.getProperty("java.home"));
      System.out.println("JAVA class.path : " + System.getProperty("java.class.path"));
      System.out.println("JAVA library.path : " + System.getProperty("java.library.path"));
      System.out.println("Runtime totalMemory : " + Runtime.getRuntime().totalMemory());
      System.out.println("Runtime freeMemory : " + Runtime.getRuntime().freeMemory());
      System.out.println("Runtime maxMemory : " + Runtime.getRuntime().maxMemory());

      String[] commandArr = {"cmd", "/c", "\"C:\\Program Files (x86)\\PostgreSQL\\9.3\\bin\\pg_dump.exe\" -h 127.0.0.1 -p 5432 -U postgres -F c -b -v --lock-wait-timeout=20s -f \"C:\\csswk\\backup\\webpos_pgSQL01.tar\" TB_1001_20220316"};
      ProcessBuilder processBuilder = new ProcessBuilder(commandArr);
      processBuilder.redirectErrorStream(true);
      Process process = processBuilder.start();
      for(int i=0 ; i < commandArr.length ; i++) System.out.println(commandArr[i]);
      try {
               BufferedReader runtime = new BufferedReader(new InputStreamReader(process.getInputStream(), Charset.forName("MS932")));
                  System.out.println(runtime);
               String line;
                  while ((line = runtime.readLine()) != null) {
                      System.out.println(line);
                  }
                  int result = process.exitValue();
                  System.out.printf("result=%d%n", result);
                  Thread.sleep(5000);

              }catch (Exception e) {
      // TODO: handle exception
      }
             System.exit(0);
          }
      }

      --
      jnjp sample

        <information>
          <title>Prcess Test</title>
          <vendor>Talos Systems Corp</vendor>
          <homepage href="https://www.talos-sys.jp/"/>
          <description>TALOS Process Test App</description>
          <description kind="short">PrcoessTest for WebStartApp</description>
          <shortcut online="true">
            <desktop/>
            <menu submenu="TALOS ProcessTest"/>
          </shortcut>
         <offline-allowed/>
        </information>
        <security>
          <all-permissions />
        </security>
        <resources>
          <j2se version="1.6+" java-vm-args="-Xms512m -Xmx512m -XX:NewSize=256m -XX:MaxNewSize=256m "/>
          <jar href="process_test.jar"/>
          <jar href="javaws.jar"/>
        </resources>
        <application-desc main-class="test.process_test"/>

      ---------- END SOURCE ----------

      FREQUENCY : always


            pnarayanaswa Praveen Narayanaswamy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: