So…, I’ve made a plugin for Eclipse that generates a new java project and ads files from templates, etc… However the code in the /src directory is then uncompilable because I need to add a jar file I have to the libraries tab.
The project is already a Java project via:
org.eclipse.jdt.core.IJavaProject javaProject = org.eclipse.jdt.core.JavaCore.create(proj);
org.eclipse.jdt.core.IClasspathEntry src = JavaCore.newSourceEntry(folder.getFullPath());
IClasspathEntry jre = JavaCore.newContainerEntry(new Path(
org.eclipse.jdt.launching.JavaRuntime.JRE_CONTAINER), new IAccessRule[0],
new IClasspathAttribute[] {
JavaCore.newClasspathAttribute("owner.project.facets", "java")
}, false);
IClasspathEntry[] entries = new IClasspathEntry[] {
src, jre
};
javaProject.setRawClasspath(entries, proj.getFullPath().append("bin"), new NullProgressMonitor());
And now, basically, I need to do programmaticaly, what the button “Add Jars…” does.

Been struggling with this for a while…
Any code tips or a link to a tutorial that DOES EXACTLY THIS would be helpful. Please no links to generic Eclipse plugin tutorials 🙂 as I’ve probably seen them all by now…
Thnx a lot
Here’s how I did it, not sure if your reqs are exaclty the same, but hope it helps in some way…
where addJar() looks something like this: