Usually when you do a new java project, there are several essential file such log4j properties file, other properties file and log file and you need to tell java where they are and where do you want to save the log file.
I don't want to hardcode the absolute path to these file because I am putting the projects in different machines at different development stages. For example, I using Eclipse/PC in dev stage, Ant/Unix in UAT and Production machine.
Here is my usual setup:
Project: --src --build --conf --log --output
In my understanding, src and build directory are included in the classpath and could be read right away by this.getClass().getClassLoader().getResource(".").getPath()
. However, there is not a logical method to locate the Project directory programmatically.
If I could locate the Project directory programmatically, I could tell the program that the files are at ${Project}/conf and save the log file in ${Project}/log.
Should I just use a shell script to define these variable before running the program?