java.io.Ioexception
Hi,
My application is running on Solaries and oracle application server.For system testing when i entered a file into Inbox and heat the application then the file goes to outbox .But i am getting "java.io.IOException: mv: not found" this exception .
public boolean moveAnnualRefreshFile(String strInputFileName, String strInputFolderName, String strOutPutFolderName) {
try {
String strMoveCmd = "mv " + strInputFolderName + "/" + strInputFileName + " "
+ strOutPutFolderName;
Process moveFileProcess = Runtime.getRuntime().exec(strMoveCmd);
int exitStatus = moveFileProcess.waitFor();
if(exitStatus==0) {
return true;
}
return false;
} catch (Exception e) {
DebugOut.println("Exeption in moveAnnualRefreshFile "+e);
return false;
}
}
[836 byte] By [
Silu79a] at [2007-10-2 19:18:24]

Try /usr/bin/mv. You're unlikely to have the same shell variables under an exec as you do under a normal shell.
But I've got to ask - why are you doing it this way? This is an extreamly expensive way to rename a file. If you are not moving across a file system boundry then why not just use [url=http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#renameTo(java.io.File)]File.renameTo()[/url] instead? As the Javadoc says there are potential issues with this (the different file system is the one that got me once) but it can be done.
Even if you're moving across file systems a file copy and delete would seem more efficient. An exec under Solaris is, at the O/S level, a pretty expensive thing to do, especially for something the size of an application server.