Java tutorial
import java.awt.Desktop; import java.io.File; import javax.swing.JFileChooser; public class Main { public static void main(String[] args) throws Exception { JFileChooser fileChooser = new JFileChooser(); int a = fileChooser.showOpenDialog(null); if (a == JFileChooser.APPROVE_OPTION) { File fileToOpen = fileChooser.getSelectedFile(); Desktop.getDesktop().open(fileToOpen); } } }