我知道如何用Java创建一个临时目录,但是有没有简单的方法将Java文件中的文件从jar文件复制到这个目录?java:如何将jar文件中的目录复制到tmp目录中?
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);
HMM,可以是http://stackoverflow.com/questions/5377104/how-to-extract-a-folder-from-jar的副本 – 2011-06-07 16:50:39