Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calling default XML editor for system in Java

807606Apr 12 2007 — edited Apr 14 2007
I'm looking for a way to call the system's default editor for xml files from a Java application. In other words, if I'm running on a Windows system, I might want to start Notepad, or if I'm on a Mac, maybe I want to start TextWrangler or oXygen, etc.

Essentially, I want to pass down an XML file to the system and have the underlying system determine the default editor, and then open the file in that editor.

I've seen some code using
Runtime.getRuntime().exec("cmd /c notepad.exe")
and the like, but that assumes
a) I know what the default editor for XML on the system is
b) I know the executable path for this file

I don't have a way of knowing either of those assumptions. Can anyone suggest ways for me to solve this bind?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 12 2007
Added on Apr 12 2007
4 comments
98 views