简体   繁体   English

PrintWriter日食

[英]PrintWriter eclipse

I'm using Eclipse to write code that needs to write to an output file. 我正在使用Eclipse编写需要写入输出文件的代码。 the file name comes from a command-line argument. 文件名来自命令行参数。 I don't know where it is creating the file. 我不知道它在哪里创建文件。 It says that my workspace is the default for the output file but it is no where to be found. 它说我的工作空间是输出文件的默认设置,但在哪里找不到。 This is my code 这是我的代码

try{
    PrintWriter output = new PrintWriter(new File(args[3]));
    //System.out.print(args[3]);
    output.append('l');
    output.close();
} catch(IOException e) {
    System.exit(0);
}

Add the following to your program to see the absolute path of the file. 将以下内容添加到您的程序中以查看文件的绝对路径。

File file = new File(args[3]);
System.err.println( "File: " + file.getAbsolutePath() );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM