Fix string index out of range issue if java.home path does not have the /jre suffix