Displaying  Source Code(s)  
 

 
Use of Runtime Class.

--------------------------------------------------------------------------------

Description : Runtime class is used to execute the dos command as well as
running the other applications such as word,notepad etc.
This Example shows you how to send message to other machine through Java
code.. I have used for loop just for sending one message for no of times
..

import java.io.*;
class test extends Thread
{
public void run()
{
Runtime r=Runtime.getRuntime();
Process p=null;
try
{
for(int i=0;i<=100;i++)
{
p=r.exec("net send vishal how r u!");
//p.waitFor();
Thread.sleep(5000);
}
}
catch(Exception e)
{
System.out.println(e);
}
}

public static void main(String args[])
{
test t=new test();
t.run();

}
 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG