This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Problem on declare specific path for folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem on declare specific path for folder" Watch "Problem on declare specific path for folder" New topic
Author

Problem on declare specific path for folder

Tan Joey
Greenhorn

Joined: Jun 23, 2011
Posts: 8

I am doing a project,i had created a folder in the project source folder and would like to make a file to write into this specific folder that i had created. But i don't to hardcode this specific foder's path and i have try some way to make this function work like 'String path =System.getProperty("user.dir") + "/src/<specific folder name>";' but it didn't work and pop up error message that said folder cannot be found. any help will be appreciated thank you.
Vijay Tidake
Ranch Hand

Joined: Nov 04, 2008
Posts: 146

Hi,

The best way to do this is

Create one property file(sys.properties) in your classpath(in src folder) having the folder path defined in it
eg


Load this file as Resource


Get the path variable using


Hope this helps


The important thing is not to stop questioning.Curiosity has its own reason for existing.
 
wood burning stoves
 
subject: Problem on declare specific path for folder
 
Similar Threads
How to debug jsp page
Run Servlet In Eclipse
JavaMail Session cannot be resolved to a type
run problem on Eclipse
Eclipse, OEPE plugin installed cannot deploy application