我知道如何用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