Reputation: 21
So, I'm trying to read a file like by line in java and compare it to all the words in another file and see how many of them match.
public static void main(String[] args) {
int i = 0;
int wordFound = 0;
String wordCheck;
File file = new File("wordlist.txt");
File input = new File(args[0]);
Boolean searchResult;
Either way this is my main, and im just trying to set args[0] as filename.
I am running my program like so: ? java SpellChecker >input.txt
So i guess it could be args[2] but i tried that and I'm still getting ArrayIndexOutOfBoundsException whenever i use any number in there O.o
I would appreciate any help.
THANKS!
Upvotes: 0
Views: 246
Reputation: 3870
Your way, java SpellChecker > input.txt
means all outputs of your programs will be written in input.txt
. That means if you do any kind of print, it will be written in input.txt
.
The command you need is java SpellChecker input.txt
Upvotes: 1