We have a servlet which receives a file using MultipartRequest. It works
saving the file on server's file-system, and makes a system call to
'chmod' and 'chown' to change the file's permissions:
//saves the file retrieved
outFile.renameTo(new File(completeFileName));
String[] order = new String[4];
order[0] = "chmod";
order[1]="-f";
order[2]="644";
order[3]=completeFileName;
//calls the function ejecuta to make the system call
ejecuta(order);
order[0]="chown";
order[1]="-f";
order[2]="db2inst1:db2iadm1";
order[3]=completeFileName;
//call ejecuta again
ejecuta(order);
..........
public void ejecuta(String[] ops) {
java.lang.Runtime r = java.lang.Runtime.getRuntime();
try {
java.lang.Process p = r.exec(ops);
} catch (IOException x) {}
}
The problem is r.exec is throwing NoClassDefFoundError. If I comment the
line which creates the process it works fine.
Could it be a memory problem in server? (I think if server is not
capable of creating a new process, it should throw IOException, not
NoClassDefFoundError). If I put Class.forName("java.lang.Process") at
the end of servlet code, it doesn't throw ClassNotFoundException, so
it's not a JVM configuration problem.
Any idea? Is there a more ellegant way of making the same thing,
whithout system calling?
Sorry if this is a little bit off-topic.
Thaks.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html