Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Egidius Bakker   on Dec 07 In Java Category.

  
Question Answered By: Angel Watkins   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:

try
{
Process proc = Runtime.getRuntime().exec("Notepad.exe");
BufferedReader br = new BufferedReader(new InputStreamReader
(proc.getInputStream()));
String line;
while ((line = br.readLine) != null)
{ /* do something with output  */ }
int returnValue = proc.waitFor();
br.close();
}
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.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
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.


Tagged: