Compiling
-d is output directory for new generated class files.
How to compile single Java source file
javac -d ./target/classes src/main/java/com/extuni/enum_demo4/App.java
How to compile multiple Java source files
javac -d ./target/classes
./src/main/java/com/extuni/enum_demo4/App.java
./src/main/java/com/extuni/enum_demo4/Greeting.java
./src/main/java/com/extuni/enum_demo4/Helper.java
How to compile multiple Java source files using wildcard
javac -d ./target/classes ./src/main/**/*.java
How to specify dependency jar file when compiling
Trying to compile ./src folder completely will throw exception due to junit.jar file dependency. So, it should be specified using -cp option which means –classpath as below.
javac -d ./target/classes -cp /Users/kenanhancer/.m2/repository/junit/junit/4.11/junit-4.11.jar ./src/**/*.java
Continue reading