Auto detect Java