public static void addUserLibToClassPath(IProject project, IProgressMonitor monitor) {

    monitor = Util.getNonNullMonitor(monitor);
    try {

      IJavaProject javaProject = JavaCore.create(project);
      IClasspathEntry[] oldClasspath = javaProject.getRawClasspath();
      IClasspathEntry[] newClasspath = new IClasspathEntry[oldClasspath.length + 1];
      System.arraycopy(oldClasspath, 0, newClasspath, 0, oldClasspath.length);
      IClasspathEntry gwtuserJarEntry =
          JavaCore.newVariableEntry(Util.getGwtUserLibPath(), null, null);
      gwtuserJarEntry =
          JavaCore.newVariableEntry(
              gwtuserJarEntry.getPath(),
              null,
              null,
              new IAccessRule[0],
              new IClasspathAttribute[0],
              false);
      newClasspath[oldClasspath.length] = gwtuserJarEntry;
      javaProject.setRawClasspath(newClasspath, monitor);

    } catch (CoreException e) {
      // the jar is already in the classpath.
      Activator.logException(e);
    } finally {
      monitor.done();
    }
  }