Java – How to compile multiple *.java files

java

Someone gave me their code: several *.java files under same directory (src\eval\*.java). I guess they are multiple source code files in the same project.

When trying to compile (under windows), I typed

javac -sourcepath src\eval\AlnEval.java -d bin

but I get this error when doing so:

javac: no source file.


Tried

javac src\eval\AlnEval.java

Many errors in compilation. Seems AlnEval.java uses several classes defined in other *.java files.

Best Answer

try below code

first go to your main src directory

javac -cp .;lib/<YOU_JARS>.jar -d bin  packA/*.java