I am having more than 25 jar files how to add all of them in a classpath?
Include all the directories which contain . class files and JAR files when setting the CLASSPATH. You need to load a class that is not present in the current directory or any sub-directories. You need to load a class that is not in a location specified by the extensions mechanism.
To check our CLASSPATH on Windows we can open a command prompt and type echo %CLASSPATH%. To check it on a Mac you need to open a terminal and type echo $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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With