How to wildcard include JAR files when compiling?

后端 未结 9 703
面向向阳花
面向向阳花 2020-12-01 05:30

I have the following in a java file (MyRtmpClient.java):

import org.apache.mina.common.ByteBuffer;

and ByteBuffer is inside a

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 05:42

    In javac JDK 6 and above You could use (note lack of .jar):

    javac -cp ".;*" MyRtmpClient.java
    

    to quote javac - Java programming language compiler

    As a special convenience, a class path element containing a basename of * is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR.

    For example, if directory foo contains a.jar and b.JAR, then the class path element foo/* is expanded to A.jar;b.JAR, except that the order of jar files is unspecified. All jar files in the specified directory, even hidden ones, are included in the list. A classpath entry consisting simply of * expands to a list of all the jar files in the current directory.

提交回复
热议问题