Is there a way to include all the jar files within a directory in the classpath using Eclipse?
It can be done by using command line by the following command:
java -cp "lib/*" my.package.Main
But how can it be done from eclipse?
EDIT: I edited the .classpath
entry in my project floder as:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="F:/Program Files/Java/log4j/apache-log4j-2.0-alpha2-bin/*"/>
<classpathentry kind="output" path="classes"/>
</classpath>
Here F:/Program Files/Java/log4j/apache-log4j-2.0-alpha2-bin/
is the folder where the jar
files are. But it didn't work.
UPDATE: It seems that there is no direct way to do this. And may be the easiest solution will be creating a user library.