JDK-8000331 : Problem reading a program argument containing \\\ and """
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Won't Fix
  • OS: windows_7
  • CPU: other
  • Submitted: 2012-10-02
  • Updated: 2014-03-18
  • Resolved: 2014-03-18
Related Reports
Relates :  
Description
The following program gives different results when run on Java 6 as compared to Java 8.  See comments
in the program for details.


public class replTest
{
  // When run on Windows 7, this program prints different results depending on which
  // version of Java is run.  When run with build 1.6.0-b105 (hotspot server) the command
  //
  //	java replTest \\\""1.8.0"\\\"
  //
  // prints the following:     Input: \"1.8.0\"
  //
  // When run with build 1.8.0-ea-b57 (hotspot server) the same command gives a different result:
  //
  //                           Input: \""1.8.0\"			
  //
  public static void main(String args[])
  {
      System.out.println("Input: " + args[0]);
  }
}
Comments
This is a corner case and trying to fix this will cause us to add needless logic the parser. An easy workaround exists please use that.
18-03-2014

An extra quote is being emitted in src/windows/bin/cmdtoargs.c. $ Foo.exe \\\""1.8.0"\\\" argv[0]=Foo.exe argv[1]=\"1.8.0\" <---correct $ jdk8\bin\java TestStar \\\""1.8.0"\\\" \""1.8.0\" <--extra quote
02-10-2012