I've been trying to get an image to be saved as a BufferedImage in my program, but every time I try to set the file pathname it always results in an IOException error.
File grass = new File("C:\\\\Users\\user\\eclipse-workspace\\minecraft\\textures\\GRASS.png");
private final BufferedImage grassTexture = ImageIO.read(grass);
private final BufferedImage dirtTexture = ImageIO.read(new File("C:\\\\Users\\\\user\\\\eclipse-workspace\\\\minecraft\\\\textures\\\\DIRT.png"));
As you can see I tried a couple of different patterns of backslashes. ^
I use Eclipse for my IDE and it gave me this:
Exception in thread "main" java.lang.Error: Unresolved compilation problems: Unhandled exception type IOException Unhandled exception type IOException Unhandled exception type IOException Unhandled exception type IOException Unhandled exception type IOException Unhandled exception type IOException Unhandled exception type IOException Unhandled exception type IOException
at minecraft.MinecraftGame.<init>(MinecraftGame.java:28)
at minecraft.MinecraftGame.main(MinecraftGame.java:151)
How can I prevent this error from occurring?