The system cannot find the file specified?

问题: The following code cannot find the specific file any tips on how I can't fix that. Any help will be appreciated. import java.util.Scanner; import java.io.*; public class...

问题:

The following code cannot find the specific file any tips on how I can't fix that. Any help will be appreciated.

import java.util.Scanner;
import java.io.*;

public class lab8 {
  public static void main(String[] args) throws IOException {
    FileInputStream fileIn = new FileInputStream("haiku.txt");
    Scanner scrn = new Scanner(fileIn);
    System.out.println(scrn.nextLine());
  }
}

回答1:

Try using the absolute path of the file by looking at the file properties.

E.g., /home/demouser/haiku.txt (Linux file)

  • 发表于 2019-02-23 22:14
  • 阅读 ( 373 )
  • 分类:sof

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除