【发布时间】:2011-09-10 06:07:04
【问题描述】:
我知道如何在 Java 中创建一个临时目录,但是有没有一种简单的方法可以将 Java 中的文件从 jar 文件复制到该目录?
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
File helpDir = new File(tmpDir, "myApp-help");
helpDir.createNewFile(); // oops, this isn't right, I want to create a dir
URL helpURL = getClass().getResource("/help-info");
/* ???? I want to copy the files from helpURL to helpDir */
Desktop desktop = Desktop.getDesktop();
URI helpURI = /* some URI from the new dir's index.html */
desktop.browse(helpURI);
【问题讨论】: