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 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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Argument, passing a textfile" Watch "Argument, passing a textfile" New topic
Author

Argument, passing a textfile

Keshan Pillay
Greenhorn

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
Sheriff

Joined: Oct 13, 2005
Posts: 37953
    
  22
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
Greenhorn

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: http://aspose.com/file-tools
 
subject: Argument, passing a textfile
 
Similar Threads
reusult of this a = a + a++;
Getting input with instructor code isn't working as I would expect...
Evaluating Postfix Expression
Having trouble with GUI program for mortgage calculator
Getting output to work