本帖最后由 刘勇强 于 2013-6-13 21:03 编辑
- package kth.com;
- import java.io.File;
- import java.io.IOException;
- public class ShowDir {
- /*****
- * @param args
- * @throws InterruptedException
- * @throws IOException
- */
- public static void main(String[] args) throws IOException, InterruptedException {
- // TODO Auto-generated method stub
- File dir = new File("F:\\pic\\fe\\hui");//里面全是图片
- showDir(dir);
- }
- public static void showDir(File dir) throws IOException, InterruptedException
- {
- System.out.println(dir);
- File[] files = dir.listFiles();
- for(int i=0;i<files.length;i++)
- {
- if(files[i].isDirectory())
- showDir(files[i]);
- else
- {
- File ff = new File("C:\\Users\\Patric\\Desktop\\wspace\\Exercise\\"+files[i].getName());
- files[i].renameTo(ff);//复制到当前目录下
- Runtime rt = Runtime.getRuntime();
- String str = ff.getName();
- System.out.println(str);//输出显示正确,都是正确的图片文件名
- rt.exec("D:\\Program Files (x86)\\Google\\Picasa3\\PicasaPhotoViewer.exe str");//问题在这里:想用软件把每一张图片打开,但这里无任何反应 请问问题在哪里?
- Thread.sleep(1000);
- }
-
- }
- }
- }
复制代码 |
|