As I specified in title how can I write Java code, what is portable in multiple environments. I currently work at large application what was very library dependent, now after some work I come with a solution to refactor that code using MVC in mind. For each method that calls another method from that specific java library, I want somehow to add (C\C++) macros. I understand that it is not possible in java because it is compiled at runtime.
For example:
#if(LIB=TMERR)
// Activate this code region
// Some java code here
#else if(LIB=ZPAR)
// Activate this code region
// Some java code here
My question is, if exist a solutions to exclude regions of code from java code without having syntax errors. Or the case would be to exclude these files from build, and using reflection methods for each function that call another methods from specific library TMERR or ZPAR.
Thanks