A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 吴玉辉 中级黑马   /  2012-4-19 13:32  /  1593 人查看  /  4 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

(x)=arguments   D:\eclipse work4\javaenhance\binClassLoaderAttachme.class itcastlib
  1. package cn.itcast.day2;

  2. import java.io.FileInputStream;
  3. import java.io.FileOutputStream;
  4. import java.io.InputStream;
  5. import java.io.OutputStream;

  6. public class MyClassLoader {
  7.        
  8.         public static void main(String[] args)throws Exception{
  9.                
  10.                 String srcPath = args[0];
  11.                 String destDir = args[1];
  12.                 FileInputStream fis = new FileInputStream(srcPath);
  13.                 String destFileName = srcPath.substring(srcPath.lastIndexOf('\\')+1);
  14.                 String destPath = destDir+"\\"+destFileName;
  15.                 FileOutputStream fos = new FileOutputStream(destPath);
  16.                 cypher(fis,fos);
  17.                 fis.close();
  18.                 fos.close();
  19.                
  20.         }
  21.        
  22.         private static void cypher(InputStream ips,OutputStream ops)throws Exception{
  23.                 int b = -1;
  24.                 while((b=ips.read())!=-1){
  25.                         ops.write(b^0xff);
  26.                 }
  27.         }
  28.        
  29. }
复制代码
Exception in thread "main" java.io.FileNotFoundException: D:\eclipse (系统找不到指定的文件。)

4 个回复

正序浏览
文件名、目录名或卷标语法不正确。
回复 使用道具 举报
在要找的目录中建立你需要的文件看看,感觉代码没什么问题!
回复 使用道具 举报
是不是在那个目录下没有要找的文件
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马