This week's book giveaway is in the Java in General forum. We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line! See this thread for details.
I am writing a simple command line program that takes in a file name, file1.txt. In Eclipse, in my "Run Configurations", for my arguments I put in file1.txt. file.txt is in the same directory as my class but yet it does not find the text file. How do I set Eclipse to the location of that file? In the classpath? If so, how do I do that in Eclipse?
Here is my code:
Thanks in advance
posted 7 years ago
Do you mean where can you set command-line arguments on Eclipse?
On the left there is the pane with the list of classes.
R-click the class with the main method.
click "run as"
click whichever option isn't "Java application"; in Eclipse 3 it says "open run dialog" or similar.
Click the "arguments" tag.
Put your command-line arguments in the "program arguments" box.
Done: click ??OK at the bottom right and away we go!!