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

(process) Runtime.exec() command line parsing has unacceptable behavior on all platform

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.2.0
    • core-libs
    • generic
    • generic

      The JLS 20.16.3 requires that the command line parsing use StringTokenizer(cmd)
      in the Runtime.exec(String command). The actual behavior is not acceptable. For example, the command line

      vi "a"

      (6 characters total). All shells(on both unix and win32) will let the child
      process get two argumenets (vi and a), the quote(") must be stripped. However
      the Java will pass them as (vi and "a"), the quotes have not been stripped.

      The following command will get even weird result.

      ls "Program Files"

      The Java command parser will get 3 arguement as

      ls
      "Program
      Files"

            martin Martin Buchholz
            hongzh Hong Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: