Hola, tengo un error en el IDE y no me deja compilar. El IDE subrraya el .send antes de compilar y al momento de compilar tengo un java: unreported exception java.io.IOException; must be caught or declared to be thrown
Dejo aqui mi codigo, espero puedan ayudarme.
package com.alura.screenmatch.principal;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Scanner;
public class PrincipalConBusqueda {
public static void main(String[] args) {
Scanner keyboardInput = new Scanner(System.in);
System.out.println("Ingresa el nombre de la pelicula: ");
String searchInput = keyboardInput.nextLine();
String APIKey = "MYKEY";
String url = "http://www.omdbapi.com/?apikey=" + APIKey + "&t=" + searchInput;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}