tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MeadowBrook <>
Subject Deleting work files after JspRuntimeLibrary.include
Date Sun, 31 Jan 2010 17:21:04 GMT
I am running a system that uses a .jsp page to explicitly invoke the 

function to build another web page.

In the following, the full resulting page is stored as a string in 

try {
     myout = new StringWriter();
     out = pageContext.getOut();
compileFileName, out, true);
     out = pageContext.getOut();
     HTMLString = myout.toString();
catch (Throwable t) {
     // == error processing
     HTMLString = "";
finally {

After the processing, I have no need of the original source file or the 
work files (the and the xxx_jsp.class files) so I want to 
delete them.  I use the following to delete the work files:

//  the "source" jsp uses the sessionId to guarantee a unique name
//  insert the lead underscore if sessionId starts with a digit
String workFileName = compileWorkPath +
if (!(new File(workFileName+".class").delete()) ||
     !(new File(workFileName+".java").delete()) )
    //  do appropriate error processing...

For both Tomcat5.5 and Tomcat6, the above successfully deletes the 
.class files, but not the .java files - with a file sharing exception.

It appears as if the .java files are still "open" somewhere in the 
Tomcat processing.  If I try to manually delete the .java file it also 
fails until I do another compile.   Once there is a new .java class in 
the work directory, then I can delete the prior one.

Any suggestions??  Is this a bug?

Thank you,

David Poor

PS:  If I have sent this to the wrong mailing list, please excuse the 
newbie error - and I would appreciate knowing which mailing list I 
should use.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message