Fuat Cetino

Greenhorn
+ Follow
since Jan 13, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Fuat Cetino

Ok, I solved the problem. The path to my file in builder.directory (see below) was wrong:

Correct: builder.directory(new File("/opt/temp"));

Wrong: builder.directory(new File("/opt/tmp"));

Best regards,
Ali
14 years ago
Dear forum user,

I try to build a program that execute shred with java process builder under SLES10.
Could anyone tell me, why the following code sample does not work? I get every time "no success"

ProcessBuilder builder = null;
builder = new ProcessBuilder("shred", "/opt/temp/testfile.txt");

builder.directory(new File(sfd.filePath));
try {
Process proc = builder.start();
proc.waitFor();
if (proc.exitValue() == 0)
/*DEUB*/System.out.println("success");
else
/*DEUB*/System.out.println("no success");

} catch (IOException e) {

e.printStackTrace();
} catch (InterruptedException e) {

e.printStackTrace();
}


Thank you for help.

Best regards,
Ali
14 years ago