Hello,
In a Java web application that uses groupdocs viewer 17.2.0, I am having problems when I try to delete files that were used by the viewer, more especifically, after using getDocumentInfo method from class ViewerHtmlHandler on them. The virtual machine won’t let me delete a file (in java nor in Windows) because it keeps it open. I created the following code that illustrates the problem:
public static void main(String[] args) throws Exception{
ViewerConfig config = new ViewerConfig();
config.setUseCache(true);
ViewerHtmlHandler viewerHandler = new ViewerHtmlHandler(config);
viewerHandler.clearCache();
String file = "C:\\Users\\Jorge Eduardo\\Desktop\\Infolluviaacida.jpg";
DocumentInfoContainer info = viewerHandler.getDocumentInfo(file);
System.out.println(info.getSize());
Thread.sleep(30000);
System.out.println("Finished!");
}
While this program is sleeping, I am unable to delete the file I used. Is there a method to “free” the file I used on the viewer?
Thanks in advance.
Best Regards,
Jorge Flórez