D
Danger_Duck
The code is pretty self explanatory-the commented out portion does not
work I'm guessing due to the ">" which the java runtime does not
recognize?
How do I write the output to a text file without having to use a batch
file? Things would be nice if exec() returned the output, but the
process which is returned does not do so to my knowledge. So, I try
what typically is done on command prompt.
Thanks in advance.
private String createMapFile(String binDirectory, String binName) {
// String mapCommand = "nm -t d " + binDirectory + "/" + binName + "
// try {
// proc = Runtime.getRuntime().exec(mapCommand);
// proc.waitFor();
// System.out.println("Exit value = " + proc.exitValue());
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
//
//use batch file to write into mapFile.txt:
File f = new File(binDirectory + "temp.bat");
PrintWriter p;
try {
p = new PrintWriter(f);
p.println();
p.close();
Process proc = Runtime.getRuntime().exec(binDirectory +
"temp.bat");
proc.waitFor();
System.out.println("Exit value = " + proc.exitValue());
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
f.delete();
return binDirectory.concat("/mapFile.txt");
}
work I'm guessing due to the ">" which the java runtime does not
recognize?
How do I write the output to a text file without having to use a batch
file? Things would be nice if exec() returned the output, but the
process which is returned does not do so to my knowledge. So, I try
what typically is done on command prompt.
Thanks in advance.
private String createMapFile(String binDirectory, String binName) {
// String mapCommand = "nm -t d " + binDirectory + "/" + binName + "
// Process proc;" + binDirectory + "/mapFile.txt";
// try {
// proc = Runtime.getRuntime().exec(mapCommand);
// proc.waitFor();
// System.out.println("Exit value = " + proc.exitValue());
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
//
//use batch file to write into mapFile.txt:
File f = new File(binDirectory + "temp.bat");
PrintWriter p;
try {
p = new PrintWriter(f);
p.println();
p.close();
Process proc = Runtime.getRuntime().exec(binDirectory +
"temp.bat");
proc.waitFor();
System.out.println("Exit value = " + proc.exitValue());
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
f.delete();
return binDirectory.concat("/mapFile.txt");
}