I am having more than 25 jar files how to add all of them in a classpath?
5 Answers
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.

- 91
- 1
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.

- 588,226
- 146
- 1,060
- 1,140
-
3That's a semicolon :) Use a semicolon on Windows, a colon on *NIX. – Rich Aug 02 '10 at 12:09
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).

- 102,507
- 33
- 189
- 228
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.

- 73,784
- 33
- 194
- 347

- 661
- 12
- 25