• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Java Question

cchen

Diamond Member
If I wanted to run my program with a paramenter, like java Spellchecker checkme.txt (on a unix system), what code would I use to be able to use the checkme.txt?
 
args[0] would hold the name of the file.

try {
input = new BufferedReader(new FileReader(args[0]));
// output.println("File input");// temp
} catch (IOException ex) {
System.err.println("Error opening file " + args[0] +
" failed so stopping. The error was: ");
System.err.println(ex);
System.exit(1);
}
that would create a new bufferedReader called input. you would need something like
private static BufferedReader input = null;
 
Back
Top