Refactor Java to use common interface for all OS'es