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

desktop.open fails with Open-Office on linux

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Other
    • Affects Version/s: 6, 6u5
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux, linux_ubuntu

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0"
      Java(TM) SE Runtime Environment (build 1.6.0-b105)
      Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Linux merijn 2.6.20-16-generic #2 SMP Sun Sep 23 19:50:39 UTC 2007 i686 GNU/Linux

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      It's Ubuntu 7.04

      A DESCRIPTION OF THE PROBLEM :
      When I use java.awt.Desktop; on my system to open an .odt file I get an error message from OpenOffice.org that it can't find /home/mschering/java/gota/file:/tmp/GOTA/stage.odt

      Note that /home/mschering/java/gota/ is the path where my application is and /tmp/GOTA/stage.odt is the actual file I try to open.
      This is the code:

      Desktop desktop = Desktop.getDesktop();
      File file = new File("/tmp/GOTA/Stage.odt");
      if(file.exists())
      {
              desktop.open(file);
      }

      The same code works fine with a PDF document!

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Just do this on an .odt file:

      Desktop desktop = Desktop.getDesktop();
              File file = new File("/tmp/GOTA/Stageovereenkomst.odt");
              if(file.exists())
              {
                      desktop.open(file);
              }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      OpenOffice launches the .odt file
      ACTUAL -
      I get an error message from OpenOffice.org that it can't find /home/mschering/java/gota/file:/tmp/GOTA/stage.odt

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      I get an error message from OpenOffice.org that it can't find /home/mschering/java/gota/file:/tmp/GOTA/stage.odt

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      /*
       * Main.java
       *
       * Created on 9 oktober 2007, 18:46
       *
       * To change this template, choose Tools | Template Manager
       * and open the template in the editor.
       */

      package testcase;

      import java.io.*;
      import java.awt.Desktop;


      /**
       *
       * @author mschering
       */
      public class Main {
          
          /** Creates a new instance of Main */
          public Main() {
          }
          
          /**
           * @param args the command line arguments
           */
          public static void main(String[] args) throws IOException {
              // TODO code application logic here
              
              Desktop desktop = Desktop.getDesktop();
      //REPLACE WITH VALID ODT FILE
              File file = new File("/home/mschering/Stageopdracht.odt");
              if(file.exists())
              {
                      desktop.open(file);
              }

              
              
          }
          
      }
      ---------- END SOURCE ----------
      CAP member reports the same problem with 6u5:
      ------------------------
      Found the following problem with Desktop.open that try to open an .xls file then Open Office shows the error:

       
      "/home/user/workspace/Project/file:/home/user/sample.xls does not exists"

      The wrong path is send to Open Office. The path of the file is appended to
      the current working dir.
       It can be reproduced with the following program on Ubuntu 7.04 with the newest Java VM 6u5:

      import java.awt.Desktop;

      import java.io.File;

      import java.io.IOException;


      public class XLSOpen {
          public static void main( String[] args ) {
              try {
                  Desktop.getDesktop().open( new File( "/home/user/sample.xls" ) );
              } catch( IOException e ) {

                 e.printStackTrace();

             }
          }
      }

      It is necessary that the file "sample.xls" exists in the specified directory.

        Attachments

          Activity

            People

            • Assignee:
              denis Denis Fokin (Inactive)
              Reporter:
              dav Andrei Dmitriev (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: