Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Jesse Black   on May 28 In Java Category.

  
Question Answered By: Chung Tran   on May 28

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 6 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on problem while trying to make an applet Or get search suggestion and latest updates.


Tagged: