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

HostServices.showDocument does not work on Ubuntu 14.04

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 8u66
    • javafx
    • x86
    • linux_ubuntu

      FULL PRODUCT VERSION :
      java version "1.8.0_66-ea"Java(TM) SE Runtime Environment (build 1.8.0_66-ea-b02)Java
      HotSpot(TM) 64-Bit Server VM (build 25.66-b02)

      ADDITIONAL OS VERSION INFORMATION :
      Ubuntu trusty 14.04

      A DESCRIPTION OF THE PROBLEM :
      Using HostServices.showDocument to show a .pdf file or display a folder does nothing
      on Ubuntu 14.04 - the same software runs correctly on Windows and Apple Mac
      platforms.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Try to show a pdf file with HostServices.showDocument
      Nothing happens


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      HostServices hostServices= InetSure.application.getHostServices();
      String path;
       if(filePath.charAt(0)==File.separatorChar) path= "file://" + filePath;
       else path= "file:///" + filePath;
       hostServices.showDocument(path);
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      use Desktop instead of HostServices:
      SwingUtilities.invokeLater(()-> {try{Desktop.getDesktop().open(new File(filePath));
           }catch(IOException exc) { // handle exception } });

            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: