• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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: 76393
364
  • 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!!
  •  
    Friends help you move. Good friends help you move bodies. This tiny ad will help:
    the value of filler advertising in 2021
    https://coderanch.com/t/730886/filler-advertising
    reply
      Bookmark Topic Watch Topic
    • New Topic