0

I am trying to execute a Java with Spring application from console/DOS prompt. Here are the steps I've followed:

  1. Downloaded spring-framework-3.1.0.RELEASE and unzipped it as well.
  2. Created a folder called 'springlib' on F:.
  3. Copied all the files under the folder - F:\spring-framework-3.1.0.RELEASE\dist to F:\springlib
  4. Copied all the files under the folder - F:\spring-framework-3.1.0.RELEASE\projects\spring-build\lib\ivy to F:\springlib
  5. Created a folder F:\springtest and placed below Java program in it:

    import org.springframework.context.annotation.AnnotationConfigApplicationContext;

    public class BillRunner { public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); System.out.println(context); } }

  6. Tried to compile the program as shown below:

    F:\springtest>javac -cp F:\springlib* BillRunner.java javac: invalid flag: F:\springlib\commons-httpclient.jar Usage: javac use -help for a list of possible options

  7. Why am I getting such error? What is the solution?
skaffman
  • 398,947
  • 96
  • 818
  • 769
Faisal
  • 645
  • 3
  • 11
  • 24

1 Answers1

1

The problem might be due to the way you declare your classpath :-cp F:\springlib* Maybe you could try this F:\springtest>javac -cp "F:\springlib\*" BillRunner.java but I must admit it still has to be tested. More info on problems related to wildcards in a classpath here

C.Champagne
  • 5,381
  • 2
  • 23
  • 35
  • Tried your suggestion. Still the same error:F:\springtest>javac -cp "F:\springlib\*" BillRunner.java javac: invalid flag: F:\springlib\commons-httpclient.jar Usage: javac use -help for a list of possible options – Faisal Feb 02 '12 at 11:18
  • Yes, of course. No idea why the backslash didn't show above. I've tried your suggestion exactly the way you said. – Faisal Feb 02 '12 at 11:43