Have you try using the proper File("../../something/file.txt")? It works for me perfectly. Anyway, this will stop working as soon as you package your files in a jar file. You can access the files regardless on if they are in filesystem or in jar using:
but your abc.txt would have to be in the same directory as the class that accesses it, or in a subdirectory, i.e. if your class is in: com/company/project/sub1/MyClass1.class
it will be able to access: com/company/project/sub1/resources/file.txt
but not com/company/project/other/aaa.txt
Best regards, Petr
Get a better web browser:<br /><a href="http://www.mozilla.org/products/firefox/switch.html" target="_blank" rel="nofollow">http://www.mozilla.org/products/firefox/switch.html</a>
The path name can be relative, but it is relative from the current directory, not from the directory the class resides in. So if you were running from f:/app, your declaration would be: File f=new File("classes/com/abc/qwe/rty/abc.txt"); The class Class has a particularly useful method called getResourceAsStream(), which finds a resource, like a text file or an image, in the classpath and returns an InputStream. In order to use this method, your file would need to be in a directory in the class path. In your case, probably f:/app/classes.