Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8096706

Frozen jvm when calling desktop.open(FILE) on Ubuntu

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:
    • Environment:

      Ubuntu 12.10 Ubuntu 13.10 Windows 7
      java version "1.8.0"
      Java(TM) SE Runtime Environment (build 1.8.0-b132)

      Description

      My requirement is to have a button that opens a given pdf file or directory available on the filesystem using the platform default application (i,e, Explorer/Nautilus/etc for the directories and AcrobatReader/Evince/etc for the pdf file).
      I'm not sure what's the JavaFX best practice to fulfil this requirement but my understanding is that the following code, even though an awt api, should work:
       if (Desktop.isDesktopSupported()) {
            Desktop.getDesktop().open(FILE);
       }
      There are 2 issues here:
      1. Is this supposed to work when called from the FX thread? According to RT-31468 it shouldn't, but then it's used in the official documentation http://docs.oracle.com/javafx/2/ui_controls/file-chooser.htm suggesting it should work
      2. If it is supposed to work then RT-31468 is a valid bug, tested on Ubuntu 12.10 and 13.10, the jvm freezes. Everything works on Windows 7.

      A workaround suggested on the support forum is to use HostServices.showDocument which again works perfectly on Windows but on Ubuntu opens every file or directory using the default browser (Firefox in my case)

      To summarize I think what should be addressed is:
      1. Have Desktop.open and HostServices.showDocument to work consistently across multiple operating systems.
      2. Have some official documentation showing the JavaFX way to fulfil the "open a file/directory using the default viewer/application" requirement which I think is quite common for a desktop application.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                anthony Anthony Petrov (Inactive)
                Reporter:
                avacondiojfx Andrea Vacondio (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: