Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Invalid Flag when adding .JAR to classpath

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading