import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Scanner;
import org.apache.log4j.lf5.util.StreamUtils;
/**
*lib.txt文件中就是目标jar文件的路径,根据该路径找到相应的jar包,把这些jar包归并到一个目录下
* @author Sandy
* @version $Revision: 1.1 $
* 建立日期 2011-8-12
*/
public class ReadFileWriteJarFile
{
private static final String septor="\\\\";
public static void main(String[] args) throws Exception
{
String fileName="E:\\libs\\lib.txt";
start(fileName);
}
private static void start(String fileName) throws Exception
{
Scanner scanner=new Scanner(new File(fileName));
while(scanner.hasNext())
{
String fulllibName=scanner.nextLine();
System.out.println(fulllibName);
String [] newlibNames=fulllibName.split(septor);
String libName=newlibNames[newlibNames.length-1];
InputStream input=new FileInputStream(new File(fulllibName));
OutputStream output=new FileOutputStream(new File("E:\\libs\\"+libName));
StreamUtils.copy(input, output);
}
}
}