Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Exists

 
Vincent Tomas
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Campbell Ritchie
Sheriff
Posts: 48445
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!
  •  
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic