launch editor

Hi all,

I would like to launch an external editor to edit some text. I don't know what program I will be launching as I want the OS to take care of that based on the file type. Then when the user has saved his or her changes and closed the editor, the changes will be sent back to the program.

I know I can create a temporary file and read it back in, but the tough part is telling the OS to open a given file letting it figure out what program to call. How would I do that and upon the action/event of closing the editor, the updated content will be saved by the program?

Walter

[605 byte] By [walterjwhitea] at [2007-11-27 10:19:14]
# 1

If not using jdk 6.0 then upgrade and use the java.awt.Desktop class to launch the OS associated program for the text file.

As for the changes made. Once the app has closed, you can then read the contents back into your app. I'm not exaclty sure how the notification would be achieved but atleast, you have a starting point

ICE

icewalker2ga at 2007-7-28 16:56:26 > top of Java-index,Java Essentials,Java Programming...
# 2

Cool,

I just did a search for java.awt.Desktop and found this great article:

http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/

I think I have a few ideas - I am upgrading now, hopefully it works out. Right now, I can try to monitor the process list for a specific process or maybe see what file handles are open and when it is closed, send it back up. Don't know if it's possible, but it sounds good.

Walter

walterjwhitea at 2007-7-28 16:56:26 > top of Java-index,Java Essentials,Java Programming...