[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: Stefan Zugal <csae7511@xxxxxxxxxx>
- Date: Wed, 24 Jan 2007 16:12:45 +0100
- Newsgroups: eclipse.newcomer
- Organization: EclipseCorner
- User-agent: Thunderbird 1.5.0.9 (Windows/20061207)
Hi,
consider the output of following statement (it will tell you where the
local root is):
System.out.println(new File("").getAbsoluteFile());
Anyway, if you want to take advantage of the Eclipse workspace, you will
need the org.eclipse.core.resources plugin:
ResourcesPlugin.getWorkspace()
will return the workspace. Eclipse help should give you more information
about how to use the workspace.
If you want to access files of your plugin, you may use:
Bundle#getResource(String name)
HTH,
Stefan
www schrieb:
Hi,
My Java program needs a local text file, temp.txt. My Java program is
located in Eclipse workspace, Test_Workspace. One easy way for the Java
program to find and use the text file is to hard-code the absolute path
to the file(i am using linux). But I don't like it. I hope to take
advantage of Eclipse workspace.
temp.txt has been added to the workspace, Test_Workspace, shown in
Package Explorer. But the following line cannot find the file:
BufferedReader inputStream = new BufferedReader(new
FileReader("temp.txt"));
What is wrong with me?
Thank you very much.