• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

File Exists

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 73270
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!
  •  
    reply
      Bookmark Topic Watch Topic
    • New Topic