Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法删除由Java API KML生成的KML文件_Java_Kml - Fatal编程技术网

无法删除由Java API KML生成的KML文件

无法删除由Java API KML生成的KML文件,java,kml,Java,Kml,我使用api JavaAPIforKML版本2.2生成了一个kml文件,如下所示: try { File kmlFile =files.get(TypeOfFile.kml); kmlMaker.marshal(kmlFile); logger.debug("The file " + kmlFile.getPath() + " has been created"); } catch (Fil

我使用api JavaAPIforKML版本2.2生成了一个kml文件,如下所示:

         try {
            File kmlFile =files.get(TypeOfFile.kml);
            kmlMaker.marshal(kmlFile);
            logger.debug("The file " + kmlFile.getPath() + " has been created");
        } catch (FileNotFoundException e) {
            logger.error(e.getMessage());
            throw new CoreServiceException("Error while the creation of KML file", e);
        }
生成后,我尝试用以下代码删除kml文件,但无效:

         for(int i=0;i<directoryFiles.length;i++){

            String filePath = directoryFiles[i].getPath();

            boolean fileIsDeleted = false;
            try {
                FileDeleteStrategy.FORCE.delete(directoryFiles[i]);
                fileIsDeleted = true;
            } catch (IOException e) {
                e.printStackTrace();
            }

            if(fileIsDeleted) logger.debug("The file " + filePath + " has been deleted");
            else logger.error("The file " + filePath + " hasn't been deleted");
        }
@Test
public void deleteKML() throws Exception {
    Kml kmlMaker = new Kml();
    File kmlFile = new File("C:\\Dev\\Tmp\\KML\\TEST1-913289299.kml");
    kmlMaker.marshal(kmlFile);

    Assert.assertTrue(kmlFile.delete());

} 

提前感谢您的建议和帮助。

我看到这个问题尚未解决: