1 Reply Latest reply on Mar 14, 2007 2:31 PM by Oleg Zhurakousky

    Opening a PDF  file from JBOSS.

    Radouane El Marjani Newbie

      Hi,

      I Have PDF Files on JBoss server in Directory "jboss.server.data.dir", The JBoss is running in Linux PC, I have writing EJB to read a PDF file, I try to open this file on a Windows PC. so I have writting this code:

      if (OperatingSystem.isWindows())
      process = Runtime.getRuntime().exec("cmd /c start \"\" \"" + fileName +
      "\"");
      if(OperatingSystem.isLinux())
      process = Runtime.getRuntime().exec("/bin/bash -c 'rm -f "+fileName+"'");
      // Runtime.getRuntime().exec("kfm file:"+fileName);

      else
      if (OperatingSystem.isMac())
      process = Runtime.getRuntime().exec(new String[] {"/usr/bin/open",
      fileName });

      If Jboss auf Windows lokal, there is no Problem, I can open The PDF file, but when the Jboss auf dem Server linux and I try from my PC (Window) to open this file, I have no chance.
      Have someone an idea. Thank you.
      Radouane

        • 1. Re: Opening a PDF  file from JBOSS.
          Oleg Zhurakousky Newbie

          When you test your EJB running JBoss instance on local windows machine it works simply becouse Client and Server happened to be on the same machine. Whe you run it on Linux or even another Windows machine the following code will never display a PDF file to the client.
          Realize that your code (EJB Code) is executing on the server and if the server and your code will get the server Runtime and if the server has a default editor/viewr for PDF it will be opened there and never on the client.
          Try to access your application while it is running on windows but access it from another windows machine. You will see that the file will be opened on the machine with the server.