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

SA: JPS output is wrong on Windows

XMLWordPrintable

    • x86
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.6.0_23"
      Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
      Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7600]

      A DESCRIPTION OF THE PROBLEM :
      The jps output is wrong on Windows. It cuts away the drive letter and everything trailing a blank in the path.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Start CMD.exe, enter the following:

      C:\>"C:\Program Files\Java\jdk1.6.0_23\demo\jfc\Metalworks\Metalworks.jar"
      C:\>"D:\Program Files\Java\jdk1.6.0_23\demo\jfc\Metalworks\Metalworks.jar"
      C:\>jps


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      12345 C:\Program Files\Java\jdk1.6.0_23\demo\jfc\Metalworks\Metalworks.jar
      12346 D:\Program Files\Java\jdk1.6.0_23\demo\jfc\Metalworks\Metalworks.jar
      12347 Jps

      ACTUAL -
      Without any options given to JPS:

      12345 Program
      12346 Program
      12347 Jps

      (which is totally useless!)

      With -m given:

      12345 Program Files\Java\jdk1.6.0_23\demo\jfc\Metalworks\Metalworks.jar
      12346 Program Files\Java\jdk1.6.0_23\demo\jfc\Metalworks\Metalworks.jar
      12347 Jps

      (which is missing the drive letter, an such hides the distinction between C: and D:, and such is rather useless)

      With -ml given:

      12345 C:\Program Files\Java\jdk1.6.0_23\demo\jfc\Metalworks\Metalworks.jar
      12346 C:\Program Files\Java\jdk1.6.0_23\demo\jfc\Metalworks\Metalworks.jar
      12347 sun.tools.jps.Jps -ml

      Which solves the problem, but mixes up class names and JAR names.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      There is no error message provided.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Always provided -lm to find out the path of the executed JAR file, and ignore the fact that it mixes in class names.
      Here are a couple of older bugs that discuss most of what's in this report:

      5087010 4/4 jps parsing error when jar path contains embedded spaces
      6456333 4/3 Incorrect jar name handle by jps in case java -jar.

      One observation that appears to be new in this bug report is
      the drive letter issue on Windows.

            Unassigned Unassigned
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: