Results 1 to 3 of 3
  1. #1
    atom86 is offline Member
    Join Date
    Sep 2009
    Location
    Italy, Turin
    Posts
    39
    Rep Power
    0

    Question launch a pdf/jpg/txt/doc/bmp[...] files from my code...

    I'm actually trying unsuccessfully to launch a file from my application..

    More exactly i programming, in this section of my program, a JList of saved files refeered to some projects.. so those files could be .pdf .jpg .doc and more.. I must absolutely create a "preview" JButton which launch the refeered application of that file.. for example if the user of this application select the file in my JList "project_79kl155_20080511.pdf" and then he click the button "preview", i want my program to launch automatically Acrobat Reader with the selected file opened...

    the same thing that happen if i launch a pdf,doc,jpg ecc.... file from windows cmd console..

    i tried to use Runtime.getRuntime().exec("cmd /c myPathname/myFile"); with no results and no Exceptions thrown by any methods...: i don't manage to open the associated program of that particular file..

    i'm getting crazy about a simple problem like this ...any idea?

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Check out the API docs for DeskTop

  3. #3
    atom86 is offline Member
    Join Date
    Sep 2009
    Location
    Italy, Turin
    Posts
    39
    Rep Power
    0

    Default

    Quote Originally Posted by masijade View Post
    Check out the API docs for DeskTop
    It's exactly what i did, and finally i manage to solve this stupid little problem!:D thank you!

    i can't post link so i post this "auto-censored" link of javadocs for anyone who has my same problem:

    h**p://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/

    {moderators please forgive me}

    it's nothing difficult.. just a simple call of a method of java.awt.Desktop instance:cool:

Similar Threads

  1. Java based code to untar / tar files
    By ErstwhileIII in forum Advanced Java
    Replies: 1
    Last Post: 03-20-2009, 02:27 PM
  2. Can I write code in 2 different files ?
    By fartek in forum New To Java
    Replies: 2
    Last Post: 02-14-2009, 03:48 PM
  3. Replies: 6
    Last Post: 02-06-2009, 08:05 PM
  4. launch a browser with a button
    By lemon3 in forum NetBeans
    Replies: 1
    Last Post: 07-07-2008, 05:49 AM
  5. how to see the code of class files
    By mary in forum Advanced Java
    Replies: 1
    Last Post: 08-02-2007, 01:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •