public static void addJar(IJavaProject javaProject, IPath jar, IProgressMonitor progressMonitor)
throws IOException,
JavaModelException {
IProgressMonitor monitor = (progressMonitor == null) ? new NullProgressMonitor() : progressMonitor;
try {
monitor.beginTask("Adding Jar " + jar + " to Project " + javaProject.getProject().getName(), 1);
IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
newEntries[oldEntries.length] = JavaCore.newLibraryEntry(jar, null, null);
javaProject.setRawClasspath(newEntries, null);