Open a text file in the default text editor… via Java?
问题 OK. Simple question. Maybe not so simple answer, though: I have a file I downloaded in Java, and I know that it\'s a text file. Is there any way that I can use Java to open that text file in whatever the default text editor is? It has to work for all OS\'s, otherwise I would just make it open with Notepad. :\\ I guess that if there\'s no way to do this I could use JOptionPane and show the contents of the text file... 回答1: You can do that with: java.awt.Desktop.getDesktop().edit(file); This