The answer depends...
Do you want to open a file in a platform independent manner so it opens the default editor associated to the file as specified by the OS or not...
If you do, then you should take a look at Desktop
For example...
File file = ...;
Desktop.getDesktop().open(file);
or
Desktop.getDesktop().edit(file);
Now, remember, this will open the associated program for the give action and is specific to the user's context, that is, I have NotePad++ setup to edit *.txt files, so on my system using this method will open NotePad++, on other systems it may open NotePad or what ever the user has configured for that file
Take a look at How to Integrate with the Desktop Class for more details