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:
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.
Re: Open external file with external program
Quote:
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.
Quote:
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.