You can't really do it...the best way would be to use a template engine...even some compilers will put the code into the end class file - the better ones would remove the code if it is not required...You must make the constants final and also you must set them to an absolute value for the compiler to be able to remove the code.
public static final boolean ABC = true // This will be enough for the compiler to remove code
public static final boolean ABC = [any method call] // This is not enough to work and will leave the code in there
Again, some compilers may still put the code in there even though it is unreachable (that is why some IDE's will warn you that the code is unreachable so that you remove the code that is not needed)
However,
Directives are nasty and most likely you need to be using an implementation of an interface instead of a directive! good for low level coding when needed (to minimize memory foot print) - certain special devices like pace makers and the like but why would you want to use them in java?
-Dname=valueand then useSystem.getPropertyto gets the value ofname.