This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Command line arguments via (string[] args) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Command line arguments via (string[] args)" Watch "Command line arguments via (string[] args)" New topic

Command line arguments via (string[] args)

Matt Moore

Joined: Dec 14, 2004
Posts: 2

I've been told that you can pass a text file to be inputted via the (String[] args) part of the main method.


java someprogram someinput.txt

Well thats what I'd like to do, how do I do it?



Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272

This assumes the file is in the same directory as someprogram, otherwise you have to specify the path.

Mike Gershman
SCJP 1.4, SCWCD in process
Don't get me started about those stupid light bulbs.
subject: Command line arguments via (string[] args)
Similar Threads
how to know when a String went to the string constant pool
How do i compile and run a java program in JBuilder
Signature of main()
Calling Servlet form Command Prompt
Dealing with dates and Zulu time...