Fix java detection exception