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

Not able to parse command line arguments when path contains multiple quotes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • tbd
    • 7u51
    • tools

      FULL PRODUCT VERSION :
      java version "1.7.0_51"
      Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      When path to Java executables contains an even number of quoted string, this executable is not able to parse the command line arguments.

      So, for example:
      1/ C:\>"C:\Program Files\Java\jre7\bin\java" -version => works
      2/ C:\>"C:\Program Files"\"Java\jre7\bin\java" -version => doesn't work
      3/ C:\>"C:\Program Files"\"Java"\"jre7\bin\java" -version => work

      On jre 1.6.0_45, all these examples work.

      See on java.exe, pack200.exe, keytool.exe

      REGRESSION. Last worked in version 6u45

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.6.0_45"
      Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
      Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      C:\>"C:\Program Files\Java\jre7"\"bin\java" -version

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Java version should be displayed:
      java version "1.7.0_51"
      Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
      ACTUAL -
      Java usage is displayed instead:

      C:\>"C:\Program Files\Java\jre7"\"bin\java" -version
      Usage: java [-options] class [args...]
                 (to execute a class)
         or java [-options] -jar jarfile [args...]
                 (to execute a jar file)
      where options include:
          -d32 use a 32-bit data model if available
          -d64 use a 64-bit data model if available
          -server to select the "server" VM
          -hotspot is a synonym for the "server" VM [deprecated]
                        The default VM is server.

          -cp <class search path of directories and zip/jar files>
          -classpath <class search path of directories and zip/jar files>
                        A ; separated list of directories, JAR archives,
                        and ZIP archives to search for class files.
          -D<name>=<value>
                        set a system property
          -verbose:[class|gc|jni]
                        enable verbose output
          -version print product version and exit
          -version:<value>
                        require the specified version to run
          -showversion print product version and continue
          -jre-restrict-search | -no-jre-restrict-search
                        include/exclude user private JREs in the version search
          -? -help print this help message
          -X print help on non-standard options
          -ea[:<packagename>...|:<classname>]
          -enableassertions[:<packagename>...|:<classname>]
                        enable assertions with specified granularity
          -da[:<packagename>...|:<classname>]
          -disableassertions[:<packagename>...|:<classname>]
                        disable assertions with specified granularity
          -esa | -enablesystemassertions
                        enable system assertions
          -dsa | -disablesystemassertions
                        disable system assertions
          -agentlib:<libname>[=<options>]
                        load native agent library <libname>, e.g. -agentlib:hprof
                        see also, -agentlib:jdwp=help and -agentlib:hprof=help
          -agentpath:<pathname>[=<options>]
                        load native agent library by full pathname
          -javaagent:<jarpath>[=<options>]
                        load Java programming language agent, see java.lang.instrument
          -splash:<imagepath>
                        show splash screen with specified image
      See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No error message.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      C:\>"C:\Program Files\Java\jre7\bin\java" -version

      Or even:
      C:\>"C:\Program Files"\"Java"\"jre7\bin\java" -version

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: