[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.newcomer] Re: Problem with finding a text file in Eclipse workspace
|
- From: www <www@xxxxxxxxxx>
- Date: Wed, 24 Jan 2007 16:58:52 -0500
- Newsgroups: eclipse.newcomer
- Organization: EclipseCorner
- User-agent: Thunderbird 1.5.0.9 (Windows/20061207)
zorro wrote:
Hi
It all depends on whether you are writing a Web app or just a Java app.
If you are using a Web app then you should not use
BufferedReader inputStream = new BufferedReader(new
FileReader("temp.txt"));
you have to use what Dave Wegener had suggested...something like
..getResourceAsStream(...)
But if it is just a Java standalone application, then I can provide you
the solution
Use the Run... option on the Menu bar pick Java application (New
configuration) and in the "Arguments" tab make use of the Working
directory. The default is c:\eclipse.So when u look for temp.txt the
eclipse environment will look only in c:\eclipse. Change it to
"Other" and pick from either "Workspace" or "FileSystem" or "Variable"
and give proper value where the temp.txt file is located. Now the
program should work without any problem.
Hope this helps.
Regards,
Z
Thank you very much. I have learned something very useful.
I am writing stand alone Java application. I checked my Eclipse:
Run ... -> Arguments tab: working directory is at default button
${workspace_loc:Test_Project} (I am using Linux).
My project is Test_Project. Since the text file temp.txt has been copied
to Test_Project/bin/temp.txt, with my current setting, I still don't
understand why Eclipse cannot find temp.txt. Like I said before,
temp.txt is also located at source ./src/temp.txt.
Thank you for all your help.