Home > Blockchain >  Invalid Flag when adding .JAR to classpath
Invalid Flag when adding .JAR to classpath

Time:03-22

I'm still very new to Java as a whole, but I can't seem to figure out how to add a .JAR to my class path.

Here is my javac line thats causing the issue.

javac -d %PRAC_BIN% -sourcepath %PRAC_SRC% -cp %PRAC_BIN% %PRAC_LIB%\* %PRAC_SRC%\*.java 

Inside P03.jar is a the package acsse.csc2a containing three .java files with their respective .class files.

When I run the .bat file, I receive error: invalid flag: ..\lib\P03.jar. How do I fix this?

CodePudding user response:

when classpath has one or more directories , they should separated by platform specific classpath separator char for windows ; and linux :

changing

-cp %PRAC_BIN% %PRAC_LIB%\* 

to

-cp %PRAC_BIN%;%PRAC_LIB%\*  

should work

  • Related