Needyboy
Needyboy

Reputation: 43

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 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());
  }
}

Upvotes: 1

Views: 1026

Answers (1)

Dinesh Shekhawat
Dinesh Shekhawat

Reputation: 539

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

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

Upvotes: 1

Related Questions