Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem on declare specific path for folder

 
Tan Joey
Greenhorn
Posts: 8
Eclipse IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 148
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic