Hi all,
i tried to run Linux command from Java Application.
Here i past my code:-
package com;
public class linux_java {
public static void main(String[] args) {
try {
String command = "cut -f 2,5 ABC/test.tab>ABC/test1.tab";
final Process process = Runtime.getRunt ime().exec(comm and);
int returnCode = process.waitFor ();
System.out.prin tln("Return code = " + returnCode);
} catch (Exception e) {
e.printStackTra ce();
}
}
}
result:
-------
Return code =1
But no new file was created.
But when i run "cut -f 2,5 ABC/test.tab>ABC/test1.tab" command from Linux terminal it's works.
please help me.
Thanks!
Vaskar
i tried to run Linux command from Java Application.
Here i past my code:-
package com;
public class linux_java {
public static void main(String[] args) {
try {
String command = "cut -f 2,5 ABC/test.tab>ABC/test1.tab";
final Process process = Runtime.getRunt ime().exec(comm and);
int returnCode = process.waitFor ();
System.out.prin tln("Return code = " + returnCode);
} catch (Exception e) {
e.printStackTra ce();
}
}
}
result:
-------
Return code =1
But no new file was created.
But when i run "cut -f 2,5 ABC/test.tab>ABC/test1.tab" command from Linux terminal it's works.
please help me.
Thanks!
Vaskar
Comment