Add function to deal with java versions