此命令失败了file.createNewFile();例外“系统无法找到指定的路径。”

时间:2014-01-09 00:16:53

标签: java spring

我遇到的问题是我处于无法更改代码的状态,但我可以更改配置。我正处于部署阶段。该命令在我们的测试阶段起作用。

我希望它是配置问题或权限问题。

在我的属性文件中,我有     kea.output = C:/ TLA / kea - 我使用了/即使它是windows。 Windows通常允许这样做。我要把它改成\来看看是否有帮助。

在我的applicationContext.xml文件中,我有

`<bean  class="org.xxx.xxx.export.util.FileManager">
    <property name="systemFolder" value="${system.folder}"/>
    <property name="keaOutput" value="${kea.output}"/>
  </bean>` 

问题出在FileManager中,它是Spring中的一个bean 首先我创建一个文件,然后运行它来创建文件夹。这成功运行。

        File file = new File( keaOutput
            + File.separator + EXPORT_RPT_FILE );
        createFolders( keaOutput );

public void createFolders( String folderName ) {
    File folder = new File( folderName );
    if ( !folder.exists() ) {
        folder.mkdirs();
    }
}

下一行是:

file.createNewFile();

我收到了这个部分堆栈跟踪:

java.io.IOException: The system cannot find the path specified
    at java.id.WinNTFileSystem.createFileExclusively(Native Method)
    at java.io.file.createNewFile(Unknown Source)
    at the line above file.createNewFile() 

我正在使用Java 6 64位和我的开发。计算机我使用的是Java 6 32位。

0 个答案:

没有答案