A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Command line arguments via (string args)
Joined: Dec 14, 2004
Dec 14, 2004 11:34:00
I've been told that you can pass a text file to be inputted via the (
 args) part of the main method.
Well thats what I'd like to do, how do I do it?
Joined: Mar 13, 2004
Dec 14, 2004 11:56:00
if ( args.length > 0 ) BufferedReader in = new BufferedReader(new FileReader(args));
This assumes the file is in the same directory as someprogram, otherwise you have to specify the path.
SCJP 1.4, SCWCD in process
I agree. Here's the link:
subject: Command line arguments via (string args)
How do i compile and run a java program in JBuilder
Calling Servlet form Command Prompt
how to know when a String went to the string constant pool
Signature of main()
Dealing with dates and Zulu time...
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014