Hi i am using this code to run the shell script.the thing is i want to pass argument "trng-java" while i am running program.like this
like java Classname trng-java
code:
import java.io.*;
public class Test
{
public static void main(String[] args)
{
try {
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(new String[]{"/bin/sh", "/tmp/test.sh", "trng-java"});
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line = "";
while ((line = input.readLine()) != null) {
System.out.println(line);
}
}
catch (Exception e) {
System.out.println(e.toString());
e.printStackTrace();
}
}
}
How to do this?
argsarray that's the parameter of main.$trng-java