what is java catch exception code for I/O and exec functions?
by mfoley from LinuxQuestions.org on (#5ANG1)
I have:
Code: try {
fs = new FileOutputStream(cmdFile);
ps = new PrintStream(fs);
}
catch (Exception e) { return e.getErrorCode(); }
// and
Process p = null;
try {
p = Runtime.getRuntime().exec("chmod +rx " + cmdFile);
p.waitFor();
} catch ( Exception e) { return e.getErrorCode(); }but I get:
Code:An error occurred at line: [19] in the jsp file:
getErrorCode cannot be resolved or is not a fieldThis is part of a function and I want to return the error status code of the failure. How can I do that?


Code: try {
fs = new FileOutputStream(cmdFile);
ps = new PrintStream(fs);
}
catch (Exception e) { return e.getErrorCode(); }
// and
Process p = null;
try {
p = Runtime.getRuntime().exec("chmod +rx " + cmdFile);
p.waitFor();
} catch ( Exception e) { return e.getErrorCode(); }but I get:
Code:An error occurred at line: [19] in the jsp file:
getErrorCode cannot be resolved or is not a fieldThis is part of a function and I want to return the error status code of the failure. How can I do that?