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

(process) ProcessBuilder redirecting output to file should work with long file names (win)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • None
    • core-libs
    • b51
    • windows
    • Verified

        On Windows, when redirecting ProcessBuilder output to a file using ProcessBuilder.Redirect.appendTo(file), only file names up to 250 characters are allowed. Specifying longer filenames causes an IOException.

        The IOException is misleadingly stating "Cannot find the file specified", e.g.:

        Exception in thread "main" java.io.IOException: Cannot run program "hostname.exe": The system cannot find the path specified
                at java.lang.ProcessBuilder.start(ProcessBuilder.java:1051)
                at RedirectWithLongFilename.main(RedirectWithLongFilename.java:37)
        Caused by: java.io.IOException: The system cannot find the path specified
                at java.lang.ProcessImpl.openForAtomicAppend(Native Method)
                at java.lang.ProcessImpl.newFileOutputStream(ProcessImpl.java:71)
                at java.lang.ProcessImpl.start(ProcessImpl.java:121)
                at java.lang.ProcessBuilder.start(ProcessBuilder.java:1030)
                ... 1 more



              stuefe Thomas Stuefe
              stuefe Thomas Stuefe
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: