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

javac classpath with wilcard returns "invalid flag"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 6u23
    • tools
    • 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) 64-Bit Server VM (build 19.0-b09, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Wersja 6.1.7600]

      A DESCRIPTION OF THE PROBLEM :
      I found that javac with -cp does not work as excepted with jar wilcard *.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I made simple "Hello World" project (one class, package testing) using one JAR library (located at C:\Test\commons-lang-2.6.jar). In base directory (C:\Base) I made such command:

      C\Base>javac -cp C:\Test\* testing\App.java

      App,java is simple public class with classic public static void main, which uses one static method from
      Commons Lang: org.apache.commons.lang,StringUtils.upperCase("test");.

      After execution of above command I get such error:
      javac: invalid flag: C:\Test\commons-lang-2.6.jar
      Usage: javac <options> <source files>
      use -help for a list of possible options

      C:\Test dir contains 2 files: commons-lang-2.6.jar and commons-lang-2.6.pom




      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      compilation witohut error
      ACTUAL -
      compilation error

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      javac: invalid flag: C:\Test\commons-lang-2.6.jar
      Usage: javac <options> <source files>
      use -help for a list of possible options

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package testing;

      import org.apache.commons.lang.StringUtils;

      public class App
      {
         public static void main(String[] args)
         {
      System.out.println(StringUtils.upperCase("test"));
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      C\Base>javac -cp C:\Test\*; testing\App.java
      C\Base>javac -cp .;C:\Test\* testing\App.java
      C\Base>javac -cp .;C:\Test\commons-lang-2.6.jar testing\App.java

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: