Open PDF file in linux using java

Hi..
How can I open a PDF file in linux using java.
I am able to open PDF in windows and mac using this code
in Windows
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);
in mac
Runtime.getRuntime().exec("open " + path_of_PDF);
But nothing is working with linux.
Please help
Thanks

appi wrote:
Hi.. I found the JDIC binary files. There are different binaries for all the plateform. Is there any solution which is independent of plateform.Yes, and we already told you: Use JDK6, which has those libraries built into the standard class library.
How can I use these binaries in my existing project. does it work, If I place them at same place where other .class files are kept.Read the documentation of the JDIC project. I'm sure they answer this question in their FAQ.

Similar Messages

  • Open a PDF file in linux using java

    Hi..
    How can I open a PDF file in linux using java.
    I am able to open PDF in windows and mac using this code
    in Windows
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);
    in mac
    Runtime.getRuntime().exec("open " + path_of_PDF);
    But nothing is working with linux.
    Please help
    Thanks

    One thread is enough:
    http://forum.java.sun.com/thread.jspa?threadID=5267458

  • Open a file dialog box using java

    Duncan & Frank or anyone
    Can you please tell, or give me a link, which explains how to open a file dialog box using java, and not webutil.
    I'm trying to read a file on the desktop and update a database table.
    Thanks

    See Open File Dialog on the WEB... If you can get me the full version numbers I can tell you your supported position.
    Regards
    Grant

  • Problem in opening pdf file in linux

    how can i open a pdf file in linux(openSuse)..i can open .doc, .xls, .pdf in windows using the code.. its working fine..
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);like that i want to open in linux...
    i would be very grateful to you and i need help..plz
    plz............
    Thanks in Advance....

    I've used code like
    File path=new File("/home/RichHelp.pdf");                Runtime.getRuntime().exec("Desktop.getDesktop().open()"+path);i'm getting these errors
    java.io.IOException: Cannot run program "Desktop.getDesktop().open()/home/RichHelp.pdf": java.io.IOException: error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
    at java.lang.Runtime.exec(Runtime.java:593)
    at java.lang.Runtime.exec(Runtime.java:431)
    at java.lang.Runtime.exec(Runtime.java:328)
    at richwoods.MasterScreen.actionPerformed(MasterScreen.java:795)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1216)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1257)
    at java.awt.Component.processMouseEvent(Component.java:6038)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
    at java.awt.Component.processEvent(Component.java:5803)
    at java.awt.Container.processEvent(Container.java:2058)
    at java.awt.Component.dispatchEventImpl(Component.java:4410)
    at java.awt.Container.dispatchEventImpl(Container.java:2116)
    at java.awt.Component.dispatchEvent(Component.java:4240)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
    at java.awt.Container.dispatchEventImpl(Container.java:2102)
    at java.awt.Window.dispatchEventImpl(Window.java:2429)
    at java.awt.Component.dispatchEvent(Component.java:4240)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
    Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
    at java.lang.ProcessImpl.start(ProcessImpl.java:65)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
    ... 31 more

  • Unable to open PDF file in browser using Reader 9 with IE8

    I just updated to IE8 and when trying to open a PDF file on the browser, I received a message stating to use Adobe Reader 8 or 9.  I downloaded AR9 and still receive the same message and cannot open PDF files in browser window.  It defaults to my Adobe Acrobat 6.0 which will not open the file.  I have Windows XP.  I do not have a problem opening a PDF file in Yahoo mail with AR9.  I have tried many different ideas on the web to no avail.  Appreciate any help to be able to default to open PDF files in the browser using AR9 which is apparently required by IE8.

    Fixed problem by taking to a computer store to find that my hard drive storage was maxed out.  I had the hard drive repaced with a larger amount of storage.   Problem resulted from inadequate amount of storage space which prevented me from downloading and installing Adobe Reader 9.
    Thanks to al that responded.  

  • I cannot open pdf files with Firefox using a Mac 10.5.8 OSX

    The new version of Firefox does not support opening pdf files using a Mac 1.5.8 OSX with an Intel processor. Anything I can do?

    ios 6 requires itunes 10.6.3 or higher which requires Mac OS 10.6.8 or higher

  • Opening .pdf files from forms using OLE

    Hi,
    I want to open, print , save and save as pdf files from forms using OLE . Please help me with the same.
    Thanks
    Vidya

    If you are in client/server mode, you can put an OLE container component on your form. However, be warned that this method does not work when you convert to the forms server web enabled mode. If you anticipate moving your application to the web anytime soon, my advice would be to web-enable first and then add in the feature to view .pdf (or other) files. In our client/server app, I went to a lot of trouble to add in OLE features such as you describe, and now I have to completely re-write those features for the web.

  • Could not open PDF Files with Safari using Lion - Solution

    Two for one solution:
    After installing Lion on my Macbook Pro, I could not open PDF files on line via Safari and iPhoto 11 kept crashing.
    Well, the solution for bothy problems was to remove the "3ivx" file. 
    The easiest way to do so is go to Applications > 3ivx folder > run Remove 3ivx app.
    OR:
    Finder > Library folder > Application Support folder > drag "3ivx" folder to trash and trash.

    Does Safari - Help - Installed Plug-ins show anything for pdf other than WebKit built-in PDF ?

  • How to open pdf files in browser using flex

    hi,
    my project is having a Document explorer wchich contains pdf
    files,iwant to open it in the browser.can any one tell me how to
    open pdf documents using flex programming(i tried with different
    thing like swf's but my client wants only pdf formatt).

    Another option is by calling a JSP page. This example will
    open a pdf file into a new browser without displaying the download
    "save" prompt.
    Function to call the JSP:
    private function downloadFlyer(event:Event):void {
    var jspLink:URLRequest = new
    URLRequest("jsp/downloadpdf.jsp?fileName=Fundraiser_flyer_2008.pdf");
    navigateToURL( jspLink, "_blank" );
    JSP code:
    <%@ page errorPage="error.jsp" %>
    <%@ page import="java.io.*" %>
    <%
    //Get the parameters
    String downloadFileName=request.getParameter("fileName");
    String fileName = application.getRealPath("/downloads/" +
    downloadFileName);
    File file = new File(fileName);
    if (!file.exists()) {
    throw new IOException("File does not exist.");
    // Get the size of the file
    long length = file.length();
    // You cannot create an array using a long type.
    // It needs to be an int type.
    // Before converting to an int type, check
    // to ensure that file is not larger than Integer.MAX_VALUE.
    if (length > Integer.MAX_VALUE) {
    throw new IOException("File too big.");
    response.reset();
    response.resetBuffer();
    response.setContentType( "application/pdf" );
    response.setHeader ("Content-Disposition", "filename=" +
    downloadFileName);
    //Prevent the Java error: "getOutputStream() has already
    been called for this response"
    out.clear();
    out = pageContext.pushBody();
    InputStream in = new FileInputStream(file);
    OutputStream output = response.getOutputStream();
    try {
    int curByte=-1;
    while( (curByte=in.read()) !=-1){
    output.write(curByte);
    } catch (IOException ioe) {
    ioe.printStackTrace(System.out);
    } finally{
    output.flush();
    in.close();
    response.flushBuffer();
    %>

  • How to open pdf file in safari using adobe reader

    I am trying to open a pdf file, that is a fillable form, however I get the following message:
    Please wait...
    If this message is not eventually replaced by the proper contents of the document, your PDF viewer may not be able to display this type of document.
    You can upgrade to the latest version of Adobe Reader for Windows®, Mac, or Linux® by visiting http://www.adobe.com/products/acrobat/readstep2.html.
    For more assistance with Adobe Reader visit http://www.adobe.com/support/products/ acrreader.html.
    Windows is either a registered trademark or a trademark of Microsoft Corporation in the United States and/or other countries. Mac is a trademark of Apple Inc., registered in the United States and other countries. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries."
    I have followed the link above and downloaded the new version but I keep getting this message.
    can anyone help?

    it didnt work, i tried chrome as well, but now found a way around it, actually the system was set to open files in the previewer, so I had save as the pdf file and then open it with pdf, and it worked.

  • How to run SQL script file on Linux using Java ?

    Hi,
    I need to execute .sql file using java. I used following approach for this.
    private void runScriptEvent(java.awt.event.ActionEvent evt) {                               
            String sqlOutput = "";
            String sqlPromptLines="";
            String currentFunctionName = "";
            if(con!=null){
                String userName = jTextField4.getText();
                String password = jPasswordField1.getText();
                String databaseName = jTextField3.getText();
                try {
                    String script_location = "";
                    ProcessBuilder processBuilder =null;
                    Process process = null;
                    //File file = new File("C:/ScriptFile");
                    File file = new File("./SQL_Script");
                    //File file = new File("E:\\install\\SQL_Script");
                    if(file.exists()){
                        File [] list_files= file.listFiles(new FileFilter() {
                                        public boolean accept(File f) {
                                        if (f.getName().toLowerCase().endsWith(".sql"))
                                        return true;
                                        return false;
                    int count = 0;
                        for (int i = 0; i<list_files.length;i++){
                            script_location = "@" + list_files.getAbsolutePath();//ORACLE
    //currentFunctionName = list_files[i].getName();
    StringTokenizer st = new StringTokenizer(list_files[i].getName(), ".");
    while(st.hasMoreTokens()) {
    currentFunctionName = st.nextToken();
    String extention= st.nextToken();
    System.out.println("Function Name = "+currentFunctionName + "\t Extention = " + extention);
    processBuilder = new ProcessBuilder("sqlplus",userName+"/"+password+"@"+databaseName, script_location); //ORACLE
    processBuilder.redirectErrorStream(true);
    process = processBuilder.start();
    BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
    String currentLine = null;
    while ((currentLine = in.readLine()) != null) {
    sqlPromptLines = " "+sqlPromptLines + currentLine +"\n";
    count ++;
    System.out.println(count+" " + currentLine);
    if(currentLine.equalsIgnoreCase("Function created.")){
    sqlOutput = "\n" sqlOutput currentFunctionName + " " currentLine"\n" ;
    break;
    }// end while
    in.close();
    process.destroy();
    }//end for
    }//end if file exists
    } catch (IOException e1) {
    jTextArea1.setText(e1.getMessage());
    System.out.println("Script Done");
    jTextArea1.append(sqlOutput);
    }// end id Connection is not null
    Above code working appropriate on Windows but not on Linux.
    is there any changes needed ?
    Regards,
    Ajay
    Edited by: Ajay Sharma on Nov 21, 2012 6:43 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi gimbal2,
    about code
    jTextArea1.setText(e1.getMessage());I am using this code so that the user will be prompted with a message rather than stack trace.
    About the issue I am getting on linux i believe its because of following statement.
    processBuilder = new ProcessBuilder("sqlplus",userName+"/"+password+"@"+databaseName, script_location); //ORACLERegards,
    Ajay
    Edited by: Ajay Sharma on Nov 23, 2012 12:05 PM
    Edited by: Ajay Sharma on Nov 23, 2012 12:06 PM

  • Opening PDF file in Acrobat using SWF???

    I spent the whole day figuring out the floating SWF menu on
    top of Adobe Acrobat. Unfortunately, on some computers (I can't
    figure out why) when I click on one of the items in the SWF menu
    (in this case a .PDF file), the PDF file opens in its native
    application (err: Adobe Acrobat). However in some computers which
    has almost identical programs installed (Winxp, acrobat 7, etc),
    Acrobat opens up in Internet Explorer.
    Is there a way such as an action script to where the link
    will ALWAYS open PDF in Acrobat and not in Internet Explorer?
    Thank you very much in advance.

    Post your question in the forum for Adobe Reader.

  • Can no longer open PDF Files

    After running MacKeeper (may be a coincidence), I can nolonger open PDF files. I used to be able to double click and they would open (I think in Preview). Now I get a mesage that I can't open with this version of Mac OS X. Same if I try to open Preview. I am using10.5.8. Can't open with Pages. Can open with Acrobat Reader 5. from within the app.I have restarted my Mac and run software update. How would I redownload Preview or maybe there is another fix??
    Need help. Thanks in advance.

    Partly great news Stuart, thanks!
    No idea how ZeoBit gets away with this slime ware.
    There are many good 3ed party Disk/maintenance apps like DiskWarrior, DRive Genius, & maybe even TechTool, but for free...
    At this point I think you should get Applejack...
    http://www.macupdate.com/info.php/id/15667/applejack
    After installing, reboot holding down CMD+s, (+s), then when the DOS like prompt shows, type in...
    applejack AUTO
    Then let it do all 6 of it's things.
    At least it'll eliminate some questions if it doesn't fix it.
    The 6 things it does are...
    Correct any Disk problems.
    Repair Permissions.
    Clear out Cache Files.
    Repair/check several plist files.
    Dump the VM files for a fresh start.
    Trash old Log files.
    First reboot will be slower, sometimes 2 or 3 restarts will be required for full benefit... my guess is files relying upon other files relying upon other files! :-)
    Disconnect the USB cable from any Uninterruptible Power Supply so the system doesn't shut down in the middle of the process.
    What happens when you try to use Preview to view PDFs?

  • Safari 7.0.4 will not allow Acrobat to open PDF files, Works ok with Chrome?

    I cannot open PDF files with Acrobat using Safari 7.0.4
    No problem if I use Chrome
    Help

    OK I will try to elaborate this time with pictures so it is clear what I am asking and what the issue I am facing is.
    The specific option I want to be able to use from within the Adobe Acrobat Pro user interface is
    File\Create\Batch Create Multiple Files
    When I select that menu item a floating tool bar thing pops up that I can drag and drop files onto.
    If I drag excel or powerpoint documents onto it and press OK it converts them fine.  If I drag MS word documents into it the documents appear in the list but when I click OK it says no files processed.
    In the process of troubleshooting I also tried using the Add Files button.  That is when I discovered that MS word documents (*.doc, *.docx) are not showing up in the list of supported file types.
    The same thing happens when I try converting a single file using the File\Create\Create PDF From File menu item. Just like above the MS word documents do not show up in the list of supported file types.
    Looking in my registry entries as suggested by the article linked to by one of the posters above I can see both *.doc and *.docx types registered in the correct place.
    Unless I can use the batch convert command as intended by the time my trial period runs out in 13 days I cannot justify buying this software. If converting the documents one at a time was acceptable I would just use Save As PDF from within MS Word which works just fine. I need the batch convert function so I can convert my whole library of word documents to PDF at once.
    Any further assistance greatly appreciated!
    Regards,
    Gray

  • Can't open pdf files with firefox

    After searching for a certain topic on Google I've tried to open the link with a pdf file, but nothing happens.
    I receive an error message as if the Proxy that we use here at the company was refusing the connection, but in fact, I've already configured it correctly. This error started after the last update to Firefox 33.0.2.
    I've already tried to change the configurations at Options > Applications > Portable Document Format with the option use Adobe Reader (default) and use Adobe Acrobat (in Firefox), and also installed an Plugin "PDF Viewer", but nothing solved the problem.
    Does anyone has the same problem?
    Thanks

    ■ Use '''Tools -> Options -> Applications ->''' <br> then look under content for Adobe Acrobat forms etc;
    <br> note a choice of options is usually available
    * see [[Options window - Applications panel]]
    Firefox is of course a web browser. <br>Acrobat reader is Adobe's program used to read and display the pfd files on your computer. Other programs may be used instead of Acrobat reader. You would normally have the Acrobat program and the pdf file present on the local computer, often both on the same hard drive, if you were opening individual pdf files directly with Acrobat.
    Firefox uses a plugin so that it may use Acrobat to open pdf files and display the results within a firefox window or tab. If you do not have that plugin installed, or it is not enabled firefox may be unsure what to do with the file and offer to save it to whatever your default local download location is, without attempting to open the file in firefox.
    ■Also see
    * [[Opening pdf files within firefox ]]
    *[[Using the Adobe Reader plugin with Firefox]]

Maybe you are looking for

  • Installed 10.5 on G5 to replace 10.3.9 and lost all

    Installed 10.5 on G5 to replace 10.3.9 and lost iphoto, itunes, all files, settings etc. I thought I was making a backup, but everything is erased now. Is there anyway to get all my files, settings, itunes, etc. back?

  • IPod touch 2gen - Sound issue

    Recently my iPod doesn't send any sound to the left headphone unless I press and hold the headphone jack in place. When i say press, i have to apply quite a bit of pressure. When i let go it stops sending sound to the left headphone again. It's not t

  • Jlist not appearing in jpanel

    I'm just messing around trying to get a JList to show work, but it won't show up. I've been going off the JList tutorial at http://java.sun.com/docs/books/tutorial/uiswing/components/list.html but I don't know what I'm doing wrong.      private class

  • How to see data for for deffirent customers with deffirent dunnings

    Hi i want to make BI report like this. how can i see balance for deffirent dunning levels at ECC system Customer Number (Payer)     Description     Dunning Level 0     Dunning Level 1     Dunning Level 2     Dunning Level 3     Dunning Level 4     Du

  • How to get numeric values

    I need to filter out certain numeric values from a column. The column has mix values of 1, 02, MA, sentences, A, 500.00, 2059678974, 006702. I used IsNumeric() to filter out non-numeric values like A or sntences, MA, etc. But I also need to filter ou