Bitcoin/Dogecoin Daemon RPC authentication - 401 status error
Ok, it seems that for some reason I didn't read this essential part:


  The easiest way to tell Java to use HTTP Basic authentication is to set a default Authenticator:


    final String rpcuser ="...";
  final String rpcpassword ="...";

  Authenticator.setDefault(new Authenticator() {
      protected PasswordAuthentication getPasswordAuthentication() {
          return new PasswordAuthentication (rpcuser, rpcpassword.toCharArray());
      }
  });