aspose file tools*
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
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem on declare specific path for folder