开发者

how to add multiple jar(s) to classpath?

I am having mor开发者_运维百科e than 25 jar files how to add all of them in a classpath?


If all the jar files are in the same folder, as of jdk6, Java supports classpath wildcards. http://download.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html

So you can use something like,

/path/to/jar/*

Also consider having a separate classpath for each project.


Separate them with a colon / semicolon (: / ;) on *nix / win

But it would be way easier to use an IDE (Eclipse, NetBeans) to handle the classpath for you.


Additionally, if the classpath is so big that you can't put this on a command line, you can set the CLASSPATH environment variable (which should be set to the semicolon-separated list of JARs).


Consider using Maven to manage your dependencies. It'll go a long way to prevent JAR-hell.


I use eclipse, so there is a for me to first put them into a folder. After which if I need to add it to build path, I just go to the build path option to browse to the folder and select all. You can also import them easily by browsing to the folder and select all too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜