Error de javac al ejecutar Java con la aplicación basada en la consola Spring

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?

preguntado el 02 de febrero de 12 a las 11:02

¿Qué hay dentro del springlib directory? jars? -

1 Respuestas

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 aquí

Respondido 02 Feb 12, 15:02

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 <options> <source files> use -help for a list of possible options - Faisal

Yes, of course. No idea why the backslash didn't show above. I've tried your suggestion exactly the way you said. - Faisal

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.