English 中文(简体)
Javameth Can t Pick Up file
原标题:Java Method Can t Pick Up Files

I m 撰写一份“ Java”方案,该方案有工作拖拉,并放下档案总公司。 DnD GUI公司的所有档案都安装在有档案名称的搜索室。 我采用的方法是,通过阵列,排除只离开档案名称的道路,然后将档案名称(供斯堪纳人使用)和预想的产出档案名称(供印刷商使用)发送到每 lo末这种方法:

public void fileGenerator(String in, String out) {          
    try {
    String current_directory = System.getProperty("user.dir");
    Scanner input = new Scanner(new FileReader(current_directory+"/"+in));
    PrintWriter output = new PrintWriter(current_directory+"/"+out);
        while(input.hasNext()) {
            String line = input.nextLine();
            output.println(line);
        } output.close(); 
    input.close();
    } catch (FileNotFoundException e) {
        System.out.println(e.getMessage());
    }
}

法典没有发挥作用,它没有编制产出文件。 我正在完全走一条“没有这种档案或目录”错误...... 我在终点站进行了测试,这是正确的道路。 感谢任何投入。

我应该指出,所有 Java源档案、类别和投入档案都属于同一目录。

感谢!

最佳回答

第一问题 我认为,你无视这一例外,因此,你不知道它是否成功地打开了投入文件。 不要忽视例外情况,即使你不知道与这些例外情况做些什么,也不要加以印刷,以便你能够稍后分析你的问题。

第二,对《守则》进行ug击,看它是否有一个例外,如果有的话,则看每个步骤的价值是什么。

第三,为了回答你的问题,假定你与Eclipse合作,如果你以相对的道路提到档案,工作目录不是来源/类别,而是项目夹。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签