832706 wrote:You do not get env.var. content with getProperty().
A suggestion that has been made is to use System.getProperty() to extract the desired behavior from environment variables at run time.
C:\> set foo.bar="environment variable" System.out.println(System.getenv("foo.bar")); c:\> java -Dfoo.bar="property value" System.out.println(System.getProperty("foo.bar"));
Any thoughts?A configuration file.
832706 wrote:You could possibly use assertions.
radtad82 wrote:Have done it at times using ANT scripts to replace markers in a source with actual content from its configuration files.
Sometimes I suppose it would be handy to have a preprocessor in Java. Then again, having something go through your code and replace parts of it just seems error-prone. Even if it works, you still have to worry about what the real code is that's passed to the compiler - the preprocessor output. I'm guessing that's why the designers of Java decided not to have a preprocessor. The code you write is what gets compiled.