JNLP FileSaveService打开文件打开对话框

keu*_*leJ 8 jnlp swing java-web-start

嗨,我正在尝试从Java Webstart应用程序中保存文件.

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);
   }
}
Run Code Online (Sandbox Code Playgroud)

一切正常,除了出现的对话框看起来像一个"打开"文件对话框,而不是像"保存"文件对话框:

FileDialog的

任何帮助,将不胜感激.

keu*_*leJ 0

这似乎已在 JRE bersion 1.7.0_21-b11 Java HotSpot(TM) 64 位服务器 VM 中修复

就在那里:https://bugs.java.com/bugdatabase/view_bug? bug_id=2227257