Meaningless Drivel is fun!
The moose likes IDEs, Version Control and other tools and the fly likes File Exists Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "File Exists" Watch "File Exists" New topic

File Exists

Vincent Tomas

Joined: Jan 16, 2007
Posts: 15
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

Joined: Oct 13, 2005
Posts: 45255
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!!
    I agree. Here's the link:
    subject: File Exists
    It's not a secret anymore!