Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Anonymous
Anonymous asked in Computers & InternetProgramming & Design · 9 years ago

How use files in folders for Eclipse Java?

I am making a small program in eclipse, that requires the ability to check files. These files will be pre-made, as I code the program and will be output as part of the deliverables at the end.

In my project folder, I have the "Bin" (output) and "src" (Source) folder. Inside source, I created a "res" (Resources) folder. This folder is then mirrored into the "bin" folder, as eclipse does.

Inside the "res" folder I am making a few .txt files, which my program will read.

The program is set to read the "res" folder via a RELATIVE directory path, so the whole project is moved, it will still work.

However, when I compile and run in eclipse, it fails to load the files.

If I simply open the .java or .class file in the lightweight ReadyToProgram, it correctly reads the directory's files and runs.

Is there some good reason as to why eclipse can't see files that are a part of the project?

2 Answers

Relevance
  • Anonymous
    9 years ago
    Favorite Answer

    ReadyToProgram is using the actual file paths.

    Eclipse is using debug file paths for execution. If you want Eclipse to ignore this due to the fact you know the paths will be correct when taken out of the development environment then you need to change the project properties to include the res folder in the buildpath. Check this article out [1] for more information

  • 9 years ago

    Although you mirrored the "res" into "bin" and original in "src", there is no connection between bin/res folder and src/res folder.

    During the creation of the input and output variables, you need to make sure the source for those files are linked correctly.

    Hope that helps your problem a bit.

Still have questions? Get your answers by asking now.