Been out in the non-NetBeans world for a while and I'm trying/needing to get back but having a problem.

My app dir structure looked like this:

/conf
/log
/data
/src/com/myapp/myapp.java
/src/com/myutils/myutils.java

I used new project and selected import from existing sources in NetBeans. OK so far so good. The myapp.java does a system property check for log4j.configuration and if it isn't there, it's added it with a value from a file /conf/system.properties which has one line like:

log4j.configuration=./conf/log4j.properties

OK the problem: My intent is to have log4j.properties load from the /conf in my dir structure listed, but it looks within /src/conf for log4j.properties (I know this because I tried adding it). I seem to have complete control over where this file is as long as it's in the /src directory. However, I cannot go below the /src directory. I tried changing the /conf/system.properties file to:

log4j.configuration=log4j.properties

and then copying log4j.properties to /src and this works. Telling me that the root dir is /src. I tried a bunch of different locations in and above /src and these all worked. But if I try something like this for /conf/system.properties file:

log4j.configuration=../conf/log4j.properties

or anything else below /src it cannot find log4j.properties. You may note that I'm able to go below the /src dir for the call to open and parse /conf/system.properties.

If i use command line javac like:
cd to src/com/myapp
javac -cp ../.. myapp.java
cd to src/
java com.myapp.myapp

this works. So I'm not sure what I'm doing wrong here. Any suggestions? Any suggestions at all?

--- additionally ----
In my log4j.properties file that I get running from a place at or above /src, i have an appender that writes to a log file -> ./log/myapp.log and this gets written at /log not /src/log. I'm confused, so confused at defining exactly where my properties files will be read and where my other files will be written. What am I missing?

I guess the deal is how to address the -D<key>=<value> in the compile and run of netbeans.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.