Here you can find the source of copyFileIntoProjectFolder(String projectName, File file)
public static void copyFileIntoProjectFolder(String projectName, File file)
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.channels.FileChannel; import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.Platform; public class Main { public static void copyFileIntoProjectFolder(String projectName, File file) { FileChannel inChannel = null; FileChannel outChannel = null; List<File> libraryFiles = new ArrayList<File>(); FileInputStream istream = null; FileOutputStream ostream = null; try {/*from w w w. j av a 2 s. c o m*/ File out = new File(Platform.getLocation() + File.separator + projectName + File.separator + File.separator + file.getName()); istream = new FileInputStream(file); ostream = new FileOutputStream(out); inChannel = istream.getChannel(); outChannel = ostream.getChannel(); inChannel.transferTo(0, inChannel.size(), outChannel); libraryFiles.add(file); } catch (IOException ioException) { } finally { try { if (istream != null) { istream.close(); } if (ostream != null) { ostream.close(); } } catch (IOException ex) { } } } }