Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    4
    Rep Power
    0

    Default Open external file with external program

    I'm a new Java developer, and I have a new question. I want to open a file with another random program. I can do it easily with the java.awt.Desktop class with this code:
    Java Code:
    public static void open(File document) throws IOException {
        Desktop dt = Desktop.getDesktop();
        dt.open(document);
    }
    But is there a way to choose wich program it uses? The program is only for Ubuntu. I want a list with all regular programms that can open that file? I mean all options you see with a right click on the file. And if it is an executable file it just will execute. Is this possible with Java? And if it isn't; Is it possible with C++?

    I'm realy sory for my bad English, but I hope you'll understand my question.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: Open external file with external program

    is there a way to choose wich program it uses?
    Use the Runtime and Process classes if you want to completely specify the commandline to use.

    all options you see with a right click on the file
    That list is in the OS. I don't know how java can get that list.

Similar Threads

  1. Replies: 8
    Last Post: 04-29-2011, 06:24 AM
  2. How Can I Set The Position Of External Program?
    By *Java* in forum New To Java
    Replies: 5
    Last Post: 03-14-2011, 10:33 AM
  3. called external program does not automatically write file
    By nickvandewiele in forum New To Java
    Replies: 6
    Last Post: 02-25-2010, 02:38 PM
  4. Execute external file/program
    By sirwiggles in forum New To Java
    Replies: 3
    Last Post: 04-21-2009, 11:35 PM
  5. Use a external file in my program
    By romina in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 05:28 AM

Posting Permissions

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