code: private static CredentialProvider getCredentialProvider(TextDevice textDevice) throws IOException {
          String providerPath = textDevice.readLine("Please enter the full path to the credential provider:");
  
          if (providerPath != null) {
              Configuration conf = new Configuration(false);
              conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, providerPath);
              return CredentialProviderFactory.getProviders(conf).get(0);
          }
  
          return null;
      }
docs: \
  Returns a credential provider for the entered JKS path.
  @param textDevice the system console.
  @return the Credential provider
  @throws IOException