Provide better error message when using :: in java_import (fixes #2074)