Building Java package (javac to all files)

后端 未结 3 2178
温柔的废话
温柔的废话 2021-02-07 14:10

How to compile all files in directory to *.class files?

3条回答
  •  不要未来只要你来
    2021-02-07 14:54

    Here's a code fragment that I use to build an entire project where, as usual, source files are in a deeply nested hierarchy and there are many .jar files that must go into the classpath (requires UNIX utilities):

    CLASSPATH=
    for x in $(find | grep jar$); do CLASSPATH="$CLASSPATH:$x"; done
    SRC=$(find | grep java$)
    javac -cp "$CLASSPATH" $SRC
    

提交回复
热议问题