Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

how to call the Notepad Editor in my Java Program

  Asked By: Egidius    Date: Dec 07    Category: Java    Views: 2321

Does anyone know that how to call the Notepad Editor in my Java
Program. Basically, I have a output file in HTML formet and Now, I
would like to create a button and when user hit the button Notepad or
Visual Dev should pop up.
Right now I am looking in this link
java.sun.com/.../PropertyEditor.html .
This link talk about PropertyEditor function. So, can you please let
me know if that is the right approch to start it. I would be really



2 Answers Found

Answer #1    Answered By: Angel Watkins     Answered On: Dec 07

You may use the
the exec() method os the Runtime class then pass is the name of the
shell( system command ) something like:

Process proc = Runtime.getRuntime().exec("Notepad.exe");
BufferedReader br = new BufferedReader(new InputStreamReader
String line;
while ((line = br.readLine) != null)
{ /* do something with output  */ }
int returnValue = proc.waitFor();
catch (Exception e) // should probably be a bunch of catch
statements here...
{ /* do something with exception */ }

This is similar to System("Notepad.exe"); statement in C.
I have never actually compiled this code but think you got the idea.

Answer #2    Answered By: Burkett Bernard     Answered On: Dec 07

if u wants to open a note pad just follow it
Runtime, Process class of the java  gives such facility , after that write
where p is the object of class Process.

Didn't find what you were looking for? Find more on how to call the Notepad Editor in my Java Program Or get search suggestion and latest updates.