Passing values from one java program to another
<p>I wrote a java program which can execute another java program during runtime. The program is as follows</p>

<pre><code>import java.io.*;
public class exec
{
public static void main(String argv[])
{

int i=5,j=6,k=7;
BufferedReader rd = new BufferedReader (new InputStreamReader(System.in));    
try{
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
System.out.println("Enter class name");
String s=br.readLine();

Process pro=Runtime.getRuntime().exec(s);

BufferedReader in=new BufferedReader(new InputStreamReader(pro.getInputStream()));
String line=null;
while((line=in.readLine())!=null)
{
System.out.println(line);
}
in.close();
}
catch(Exception err)
{
err.printStackTrace();
}
}
}
</code></pre>

<p>If i execute this program it will prompt the user to enter any class name(java program) to execute. This is being done using this piece of code <code>Process pro=Runtime.getRuntime().exec(s);</code></p>

<p>Once the user enters the java class name, i should be able to pass the values 5,6,7 to the java class entered by the user. Only one value should be passed at once and the square of that number should be calculated.
How can i do this?</p>
