Try to detect distribution and stop trying to install visualvm when it's not available.