Improve Java main class detection by using Java's reflection API