Improved library detection in java