I am trying to load an image using
static Image terrain = null;
Followed by
public static void main(String[] args) {
Arcanus arc = new Arcanus();
try {
terrain = ImageIO.read(getClass().getResource("Arcanus Terrain Tileset.png"));
Font customFont = Font.createFont(Font.TRUETYPE_FONT, new File("Golden-Sun.ttf")).deriveFont(12f);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File("Golden-Sun.ttf")));
arc.setFont(customFont);
} catch (IOException e) {
e.printStackTrace();
} catch (FontFormatException e) {
e.printStackTrace();
}
}
But I get the following error
Uncompilable source code - non-static method getClass() cannot be referenced from a static context
I have no idea why its doing this any help would be apreciated