public static IPackageFragmentRoot addClassFolder(IJavaProject jproject,String containerName,IPath sourceAttachPath,IPath sourceAttachRoot) throws CoreException {
  IProject project=jproject.getProject();
  IContainer container=null;
  if (containerName == null || containerName.length() == 0) {
    container=project;
  }
 else {
    IFolder folder=project.getFolder(containerName);
    if (!folder.exists()) {
      CoreUtility.createFolder(folder,false,true,null);
    }
    container=folder;
  }
  IClasspathEntry cpe=JavaCore.newLibraryEntry(container.getFullPath(),sourceAttachPath,sourceAttachRoot);
  addToClasspath(jproject,cpe);
  return jproject.getPackageFragmentRoot(container);
}

public static IPackageFragmentRoot addClassFolder ( IJavaProject jproject , String containerName , IPath sourceAttachPath , IPath sourceAttachRoot ) throws CoreException { IProject project = jproject . getProject ( ) ; IContainer container = null ; if ( containerName == null || containerName . length ( ) == 0 ) { container = project ; } else { IFolder folder = project . getFolder ( containerName ) ; if ( ! folder . exists ( ) ) { CoreUtility . createFolder ( folder , false , true , null ) ; } container = folder ; } IClasspathEntry cpe = JavaCore . newLibraryEntry ( container . getFullPath ( ) , sourceAttachPath , sourceAttachRoot ) ; addToClasspath ( jproject , cpe ) ; return jproject . getPackageFragmentRoot ( container ) ; }
creates and adds a class folder to the class path .
