JDK-7161292 : strange java 7 behavior on windows ( star arg "*")
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 7
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2012-04-13
  • Updated: 2012-04-13
  • Resolved: 2012-04-13
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :


ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
've notice a strange java 7 behavior on windows when a "*" is used as argument:

Here is the test case, just printed out the args (pretty simple as you can see):

    public class TestStar
    {
      public static void main(String args[])
      {
        for (String _arg : args)
        {
          System.out.print(_arg + " ");
        }
        System.out.println();
      }
    }

On Unix, running  ' java TestStar "*" ', both on jdk6 and jdk7 produce the expected output:

    $ echo $JAVA_HOME

    $ ./jdk1.6.0_26/bin/java -version
    java version "1.6.0_26"
    Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
    Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)
    $ ./jdk1.6.0_26/bin/java TestStar "*"
    *
    $ ./jdk1.7.0/bin/java -version
    java version "1.7.0"
    Java(TM) SE Runtime Environment (build 1.7.0-b147)
    Java HotSpot(TM) Server VM (build 21.0-b17, mixed mode)
    $ ./jdk1.7.0/bin/java TestStar "*"
    *
    $

On windows with jkd6, I've got the expected output:

    $ echo %JAVA_HOME%
    %JAVA_HOME%

    $ c:\Program Files\Java\jdk1.6.0_29\bin\java.exe -version
    'c:\Program' is not recognized as an internal or external command,
    operable program or batch file.

    $ "c:\Program Files\Java\jdk1.6.0_29\bin\java.exe" -version
    java version "1.6.0_29"
    Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
    Java HotSpot(TM) Client VM (build 20.4-b02, mixed mode, sharing)

    $ "c:\Program Files\Java\jdk1.6.0_29\bin\java.exe" TestStar "*"
    *

    $


On windows with jkd7, the output **IS NOT** the expected one. It seems that the "*" is interpreted and list the directory

    $ "c:\Program Files\Java\jdk1.7.0_03\bin\java.exe" -version
    java version "1.7.0_03"
    Java(TM) SE Runtime Environment (build 1.7.0_03-b05)
    Java HotSpot(TM) Client VM (build 22.1-b02, mixed mode, sharing)

    $ "c:\Program Files\Java\jdk1.7.0_03\bin\java.exe" TestStar "*"
    TestStar.class

    $ "c:\Program Files\Java\jdk1.7.0_03\bin\java.exe" TestStar "\*"
    \$Recycle.Bin \a.bat \autoexec.bat \bar.emf \config.sys \dell \Documents and Set
    tings \FWLog.txt \Genius \hiberfil.sys \HP_CLJ_CP4020_CP4520_32bit_PCL6_HPDIU \H
    PDIU.log \MSOCache \pagefile.sys \partage \PerfLogs \Program Files \ProgramData
    \Recovery \System Volume Information \Users \Windows \xampp

REGRESSION.  Last worked in version 7


REPRODUCIBILITY :
This bug can be reproduced always.

Comments
EVALUATION I verified that this is an issue as described. Using the simple supplied test, on Windows any JDK7 since FCS and also JDK8 produces the list whereas on linux (also tested on Mac) 6u, 7 and 8 all print the asterisk.
13-04-2012