Hi,
Am facing a problem while exeuting UNIX command from java. Am attaching the code which I am trying to execute.
import java.io.*;
public class RunCommandExample {
public static void main(String args[]) {
String s = null;
try
{
Runtime.getRuntime().exec("password=midware1");
//p = Runtime.getRuntime().exec("export password");
System.exit(0);
}
catch (IOException e)
{
System.out.println("[IOException]. Printing Stack Trace");
e.printStackTrace();
System.exit(-1);
}
}
}
This gives me the following error.
[IOException]. Printing Stack Trace
java.io.IOException: password=midware1: not found
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:52)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:566)
at java.lang.Runtime.exec(Runtime.java:428)
at java.lang.Runtime.exec(Runtime.java:364)
at java.lang.Runtime.exec(Runtime.java:326)
at RunCommandExample.main(RunCommandExample.java:24)
Please let me know the solution for this problem.
Waiting for your valuable replay..
Thanks in advance,
Ashly.