Results 1 to 8 of 8
- 06-13-2012, 04:43 PM #1
Member
- Join Date
- Jun 2012
- Posts
- 6
- Rep Power
- 0
Absolute path for a file in Java?
Hi everyone!
I am trying to write Java programs that can access files. Is there a way that my program can access a file no matter where it is in the system without knowing the location? Currently, the program can only upload the file if it is the same directory.
Thank you very much for your time!
- 06-13-2012, 04:58 PM #2
Member
- Join Date
- Jun 2012
- Posts
- 23
- Rep Power
- 0
Re: Absolute path for a file in Java?
Do you mean to locate a file in whole filesystem? Do you know how expensive could it be?
Actually my main filesystem (I have 3 filesystems plus the main) contains 584194 files.
Do you have any aditional information of the location of the file?
- 06-13-2012, 05:22 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
Re: Absolute path for a file in Java?
You always specify a path name: if you only specify the base name, the file has to be located in the 'current working directory', otherwise the path can be a relative path (and relative to this current working directory) or an absolute path name.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 06-13-2012, 05:48 PM #4
Member
- Join Date
- Jun 2012
- Posts
- 6
- Rep Power
- 0
- 06-13-2012, 05:50 PM #5
Member
- Join Date
- Jun 2012
- Posts
- 6
- Rep Power
- 0
Re: Absolute path for a file in Java?
Hi lilezek!
I want to use the absolute path but I don't know what it includes because when the compiler keeps saying "file not found".
Thank you!
- 06-13-2012, 05:54 PM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
Re: Absolute path for a file in Java?
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 06-13-2012, 06:09 PM #7
Member
- Join Date
- Jun 2012
- Posts
- 6
- Rep Power
- 0
Re: Absolute path for a file in Java?
I am using Apple OSX with a user account. When I click on "get info" for a file, the system gives me /User/.... I assume that is the absolute path file?
Thank you!
- 06-13-2012, 07:28 PM #8
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
Using a JFileChooser to get absolute path of a file
By jetnor in forum AWT / SwingReplies: 4Last Post: 03-21-2011, 04:45 AM -
Add a jar file to Java load path at run time
By marioneil in forum Advanced JavaReplies: 5Last Post: 09-22-2010, 07:58 AM -
How to get the absolute path of a file in network drive
By Mukta in forum NetworkingReplies: 1Last Post: 04-23-2010, 09:27 PM -
File path validation in Java
By aks123 in forum Advanced JavaReplies: 2Last Post: 10-07-2009, 04:38 PM -
Specifying absolute path in web.xml
By Felissa in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 07-05-2007, 06:56 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks