def register_jvm_tool(cls,
                        register,
                        key,
                        classpath_spec=None,
                        main=None,
                        custom_rules=None,
                        fingerprint=True,
                        classpath=None,
                        help=None,
                        removal_version=None,
                        removal_hint=None):
    def formulate_help():
      if classpath:
        return ('Target address spec for overriding the classpath of the {} jvm tool which is, '
                'by default: {}'.format(key, classpath))
      else:
        return 'Target address spec for specifying the classpath of the {} jvm tool.'.format(key)
    help = help or formulate_help()
    register('--{}'.format(key),
             advanced=True,
             type=target_option,
             default='//:{}'.format(key) if classpath_spec is None else classpath_spec,
             help=help,
             fingerprint=fingerprint,
             removal_version=removal_version,
             removal_hint=removal_hint)
    jvm_tool = cls.JvmTool(register.scope, key, classpath, main, custom_rules)
    JvmToolMixin._jvm_tools.append(jvm_tool)