Java doesn’t have a preprocessor – so the simple answer is that you can’t.
This sort of thing is normally handled in Java using Dependency Injection – which is both more powerful and more flexible.
http://www.vogella.com/articles/DependencyInjection/article.html