0

Is there any way to define a project lib folder relative to a Java Project? (an project internal lib folder). There are some options to define external or absolute path libraries. I can also add each jar, but I found no way to define a internal lib folder, so any jar I add in this folder is added to the classpath (like a web library)

I changed the .classpath file manually, but this classpath entry <classpathentry kind="lib" path="lib" /> doesn't create a lib folder.

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
    <classpathentry kind="lib" path="lib"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

You can also create a User Library and set the library's directory to be in the workspace, but then you'll have to change the user library for every new jar you add.

Rafael Borja
  • 4,487
  • 7
  • 29
  • 33

1 Answers1

1

Classpath entries in Eclipse are (mostly..) absolute references. There is no built-in support for this feature.

I've found a few pages with how-to style references, but so far, only one page that claims to have solved the problem.

Paul Hicks
  • 13,289
  • 5
  • 51
  • 78
  • Then, you'll have the same problem. You'll have to change the user library for every new jar you need to add. – Rafael Borja Dec 18 '14 at 00:29
  • Didn't work for me in Eclipse Kepler - the jar files in the selected folder are ignored. – gknicker Dec 18 '14 at 00:39
  • @Rafael Shouldn't need to change the library, it's a directory, not a list of files. – Paul Hicks Dec 18 '14 at 00:43
  • Ah, my lib dir is both a native lib dir and a container built by the maven plugin. So it's working for me but not as a vanilla Eclipse feature. Are you using maven or gradle? If you are, you'll see what I'm seeing. – Paul Hicks Dec 18 '14 at 00:52
  • Hi @PaulHicks. In Eclipse Luna there's no options for a relative directory. – Rafael Borja Dec 18 '14 at 05:05