Error reading file
I keep getting Error: C:\Users\Steve\Desktop\file.txt (The system cannot find the file specified)
FileInputStream fstream = new FileInputStream("C:/Users/Steve/Desktop/file.txt");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
Java Result: 1
Im 100000x sure the file is there
There may be a better approach, but you could always use a filechooser.
There is definitely a better approach but I figured Id give you a suggestion.
Try creating a file object also.
File (Java 2 Platform SE v1.4.2)
You could also try
Give all those a shot and see if any of them work
File file = new File("C:\\MyFile.txt");
On the command line cd to the Desktop directory and type "dir *.txt" (without the quotes) to see if the file is there. Remember Java is case sensitive.
ahh..found the problem. I named it file.txt, thinking the extension actually made a difference, but I guess not, so it was saving it as file.txt.txt :D