function to toggle java versions