Bug 27687 Jar export: Cannot export java project as a jar when manifest file is present
Steps to reproduce: 1. Create a java project 2. Create a simple folder in your project. Call it "META-INF". 3. Create a simple file in the META-INF folder. Call it "MANIFEST.MF". 4. In the context menu of your java project, click "Export" and select JAR file. 5. Fill in the export destination path and click Next. 6. Click Next again to go to the JAR Manifest Specification page of the wizard. The same thing happens whether you choose "Generate the manifest file" or "Use existing manifest from workspace" and select the file, then click Finish. The popup appears: Confirm Replace The file 'E:\eclipse_workbench\eclipse\workspace\Test.jar' already exists. Do you want to overwrite it? Yes No No: takes you back to the JAR Manifest Specification page of the JAR Export wizard. Yes: brings up the following error popup: JAR Export JAR creation failed. See details for additional information Details: Problem writing /<project name>/META-INF/MANIFEST.MF to JAR: duplicate entry: META-INF/MANIFEST.MF
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/jarpackager/JarFileExportOperation.java
* @return	the iterator over the corresponding classpath files for the given file
	 * @deprecated As of 2.1 use the method with additional IPackageFragmentRoot paramter
	 */
	protected Iterator filesOnClasspath(IFile file, IPath pathInJar, IJavaProject javaProject, IProgressMonitor progressMonitor) throws CoreException {
		return filesOnClasspath(file, pathInJar, javaProject, null, progressMonitor);
	}
	
	/**
	 * Returns an iterator on a list with files that correspond to the
	 * passed file and that are on the classpath of its project.
	 *
	 * @param	file			the file for which to find the corresponding classpath resources
	 * @param	pathInJar		the path that the file has in the JAR (i.e. project and source folder segments removed)
	 * @param	javaProject		the javaProject that contains the file
	 * @param	pkgRoot			the package fragment root that contains the file
	 * @return	the iterator over the corresponding classpath files for the given file
	 */
	protected Iterator filesOnClasspath(IFile file, IPath pathInJar, IJavaProject javaProject, IPackageFragmentRoot pkgRoot, IProgressMonitor progressMonitor) throws CoreException {
		
		IFile[] classFiles= fJarPackage.findClassfilesFor(file);
		if (classFiles != null)
			return Arrays.asList(classFiles).iterator();
		if (!isJavaFile(file))
			return Collections.EMPTY_LIST.iterator();
		IPath outputPath= null;
		if (pkgRoot != null) {
			IClasspathEntry cpEntry= pkgRoot.getRawClasspathEntry();
			if (cpEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE)
				outputPath= cpEntry.getOutputLocation();
		}