File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Argument, passing a textfile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Argument, passing a textfile" Watch "Argument, passing a textfile" New topic

Argument, passing a textfile

Keshan Pillay

Joined: May 21, 2008
Posts: 29
Hey everyone! I have to make a postfix calculator, and I think i'm pretty sorted as to the code for it. However, something that confuses me is:

I use textpad to do my editing, compiling etc. I've been told I need to pass a textfile, as an argument? Or I'm just confused... How do I do this? I think its something to do with run parameters.

Many Thanks
Keshan Pillay
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46356
Difficult to be sure, but I think it might refer to a command line argument. You write

java PostfixCalc "1 2+ 3*"

The structure of your main method requires the "" otherwise it would only recognise 1. You cannot join the arguments together and maintain postfix nomenclature, otherwise it would read 12+3* or 123+4* which is ambiguous.
Keshan Pillay

Joined: May 21, 2008
Posts: 29
Thanks for the reply! I got it sorted! turns out I had to make a file I/O method, because the calculations were in a text file, and then pass the textfile as an argument through the command prompt.
I agree. Here's the link:
subject: Argument, passing a textfile
It's not a secret anymore!