I have an eclipse's .classpath file that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="lib" path="/libraries/jee/servlet-api.jar"/>
<classpathentry kind="lib" path="/libraries/junit/junit-4.6.jar"/>
<classpathentry kind="lib" path="/libraries/log4j/log4j-1.2.15.jar"/>
</classpath>
I'd like to add a whole directory of jars to the classpath - I like eclipse (or more precisely, our ant-based build process that uses .classpath format) to know several jars that reside in a single directory, without specifying them directly. How can I do that?
In general, to include all of the JARs in a given directory, you can use the wildcard * (not *. jar ). The wildcard only matches JARs, not class files; to get all classes in a directory, just end the classpath entry at the directory name.
Hold the shift key down while clicking on additional jars to add within the folder. This will allow you to select and add more than one at a time.
The default value of CLASSPATH is a dot (.). It means the only current directory searched. The default value of CLASSPATH overrides when you set the CLASSPATH variable or using the -classpath command (for short -cp). Put a dot (.)
I'm not sure eclipse can do that itself.
You could try
My colleague implemented a classpath container which recursivly looks for jars in a given directory within the workspace, have a look at http://openscada.org/2010/05/31/adding-a-directory-as-class-path-to-eclipse/
The update site can be found at http://repo.openscada.org/p2/bob/R
The plugin is licensed unter LGPL V3 and you can find the source code under git://git.openscada.org/ (http://git.openscada.org/?p=org.openscada.bob.git;a=tree)
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