Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a file with the default associated program

Tags:

java

desktop

How do I open a file with the default associated program in Java? (for example a movie file)

like image 864
Frederic Morin Avatar asked Feb 15 '09 04:02

Frederic Morin


People also ask

How do I associate a file with a program?

Open the Control Panel. In the Control Panel, click the Default Programs option. Click the Associate a file type or protocol with a program option. In the Default apps window, scroll to the bottom and select Choose defaults by file type.


1 Answers

You can use Desktop.getDesktop().open(File file). See the following question for other options: "[Java] How to open user system preffered editor for given file?"

like image 191
Zach Scrivena Avatar answered Sep 22 '22 10:09

Zach Scrivena