简体   繁体   中英

Compile java application from command line including project and library files

I have java project like this. I want to compile using javac(from command line). Can someone write exact example how to do this? It should take account all project files and all libraries provided under lib1 and lib2. All examples i have searched so far are useless

com.company.main
    Main.java
com.company.main.utils
   DoSomethingUtil.java

libraries

lib1/*.jar
lib2/*.jar

This worked for me. Hope it helps to someone

//save into files
find  /javafiles-root-location/  -name "*.java" > build/source.txt
find  /libraries-location/* /libraries-location2/*  -name "*.jar" | paste -sd ":" > build/libs.txt

//then compile
javac @build/source.txt -d build/compiled/ -cp @build/libs.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM