Program Randomly Quitting After Font.createFont() statement

After I try to get the font "ggsans", which is in the src/main/resources folder, the program randomly quits with exit code 1. Code
static {
try {
System.out.println("Test Statement!");
ggReg = Font.createFont(Font.TRUETYPE_FONT, new File("ggsans.ttf"));
ggBold = Font.createFont(Font.TRUETYPE_FONT, new File("ggsansbold.ttf"));
} catch (FontFormatException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}

public static void main(String[] args) {
System.out.println("Test Statement!");
frame = new JFrame();
System.out.println("Test Statement!");
frame.add(new MainPanel());
System.out.println("Test Statement!");
frame.setVisible(true);
System.out.println("Test Statement!");
}
static {
try {
System.out.println("Test Statement!");
ggReg = Font.createFont(Font.TRUETYPE_FONT, new File("ggsans.ttf"));
ggBold = Font.createFont(Font.TRUETYPE_FONT, new File("ggsansbold.ttf"));
} catch (FontFormatException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}

public static void main(String[] args) {
System.out.println("Test Statement!");
frame = new JFrame();
System.out.println("Test Statement!");
frame.add(new MainPanel());
System.out.println("Test Statement!");
frame.setVisible(true);
System.out.println("Test Statement!");
}
2 Replies
JavaBot
JavaBot7h ago
This post has been reserved for your question.
Hey @𝓱𝓲𝓶 𝓫𝓾𝓽 𝓯𝓻𝓮𝓪𝓴𝔂! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
𝓱𝓲𝓶 𝓫𝓾𝓽 𝓯𝓻𝓮𝓪𝓴𝔂
It outputs just one "Test Statement" and then exits One thing to note is that there's a lil pause in between the first test statement and the quit. Output
Test Statement!
[pause]
Process finished with exit code 1
Test Statement!
[pause]
Process finished with exit code 1
Want results from more Discord servers?
Add your server