|How to read linked Eclipse files? [message #1835474]
||Fri, 04 December 2020 05:41
| Theme Park
Registered: February 2011
I have set up the projects in my Eclipse workspace so that the src folder for each project is a link to a source folder on a different harddisk, that is network accessible. This means I can work on the projects on different computers, without having to copy the workspace and the source code between them.|
Before I set my workspace up this way, I had a normal workspace, and in some of the projects I would need to read some files relative to the source folders, like so:
BufferedReader in = new BufferedReader(new FileReader(".\\src\\input"));
But now that I have added links to the source folders instead, the above line doesn't work, as it takes "." to be the the root folder of the project in which the code is run.
So my question is now, is there any way I can alter the above code so I can read the file relative to the actual (linked) source code folder on the other disk, and not the project folder? Using an absolute path would defeat the whole purpose, if I work with the code on a Windows machine and a Linux machine, as they have different ways of expressing a file path.
So is it possible to change this code to do what I'd like, or is it impossible to somehow access the linked folder?
Powered by FUDForum
. Page generated in 0.01397 seconds