Fix Java version check while building