I want to know how I can get data from a text file to a java program from the command line. I am using windows.
I used
Java myprogram < c:\inputfile.txt
it doesn't work, but when I used
Java myprogram good
it works. 'good' is the word that i used it as input
FYI: when I used
Java myprogram good > c:\outfile.txt
this is for writing output to a text file ..
I need to read from the text file "inputfile.txt" and write to "outputfile.txt"
i used this
Java myprogram "c:\\inputfile.txt" > "c:\\outputfile.txt"
but not working
This code that i used it
import edu.smu.tspell.wordnet.*;
public class myprogram{
public static void main (String [] args) {
System.setProperty("wordnet.database.dir", "C:\\Program Files (x86)\\WordNet\\2.1\\dict\\");
WordNetDatabase database = WordNetDatabase.getFileInstance();
String result = "";
NounSynset nounSynset;
NounSynset[] hyponyms;
Synset[] synsets = database.getSynsets(args[0]);
for (int i = 0; i < synsets.length; i++) { //iteratre over all senses
String[] wordForms = synsets[i].getWordForms();
for (int j = 0; j < wordForms.length; j++) {
System.out.println(wordForms[j]);
}
}
}
}