Reputation: 43
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
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