How do I compile a java file that has jar dependencies?

前端 未结 1 375
慢半拍i
慢半拍i 2020-12-03 03:20

I have a helper lib that I wrote to sit on top of Apache Commons, and when I try to javac it (so that I can make it into a jar) it complains, quite reasonably, that it has n

1条回答
  •  Happy的楠姐
    2020-12-03 03:56

    For windows:

    javac -cp ".;/dir/commons.jar;/dir/more_jar_files.jar" MyClass.java
    

    For unix or mac (thanks for the tip Dawood):

    javac -cp ".:/dir/commons.jar:/dir/more_jar_files.jar" MyClass.java
    

    Which means:

    javac -cp  MyClass.java
    

    0 讨论(0)
提交回复
热议问题