*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "File Exists" Watch "File Exists" New topic
Author

File Exists

Vincent Tomas
Greenhorn

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
Sheriff

Joined: Oct 13, 2005
Posts: 38045
    
  22
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: http://aspose.com/file-tools
     
    subject: File Exists
     
    Similar Threads
    java.io.IOException: Permission denied
    A doubt about renaming a file
    Theoretical doubt from K&B book : File.separator
    File I/O
    I/O Question.