The following problems are happening under an Eclipse plug-in project.
It is all ok that I use the FileReader to read a .txt file with an absolute path (such as. new FileReader("C:\\email.txt")).But if I try to use a relative path (such as new FileReader("email.txt")), it turns bad and throws an FNE.
And what’s stranger is that, when I try to print the current path with the code new File(".").getAbsolutePath(), it turned out to be D:\Software\eclipse-rcp-juno-SR1-win32 (where I installed my Eclipse)…
I think the lazy-load design pattern of the RCP/Plug-in causes all the problem.Is it so?
This has nothing to do with the lazy loading policy or anything else OSGi-related. An application is started from some current working directory. In your case it happens that this directory is as you posted. You can set the current working directory to your liking under Eclipse’s Run Configuration (the Arguments tab).