Xin chào, tôi đang cố lưu một tệp từ Ứng dụng Java Webstart.JNLP FileSaveService mở hộp thoại mở tập tin
public class Main {
public static void main(String[] args) {
try {
FileSaveService fos = (FileSaveService) ServiceManager.lookup("javax.jnlp.FileSaveService");
//open Dialog
FileContents fc = fos.saveFileDialog("c:/data", null, new ByteArrayInputStream("Hallo Welt".getBytes()), "name.txt");
System.out.println("FileContents: " + fc);
} catch (UnavailableServiceException e) {
System.err.println("***" + e + "***");
} catch (IOException e) {
System.err.println("***" + e + "***");
}
//wait a minute
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
}
System.exit(0);
}
}
Mọi thứ hoạt động ngoại trừ hộp thoại mà đi lên trông giống như một hộp thoại tập tin "mở", không giống như một hộp thoại tập tin "tiết kiệm":
Bất kỳ trợ giúp sẽ được đánh giá cao.
Bạn có thể so sánh tham số 'fss.saveFileDialog()' với các tham số được hiển thị [ở đây] (http://docs.oracle.com/javase/6/docs/technotes/guides/javaws/developersguide/examples. html # FileSaveService). – trashgod
Tôi vừa thử [Demo dịch vụ tệp] (http://pscode.org/jws/api.html#fs) trong 1.7.0_21-b11 (Windows 32 bit) và hộp thoại mở & lưu xuất hiện như mong đợi. Điều gì tạo ra và mô hình JRE là những người dùng đang chạy? –
Chúng tôi đang sử dụng phiên bản JRE 1.6.0_31-b05 Java HotSpot (TM) Máy chủ 64-Bit VM – keuleJ