Fix java detection segfault