Since there was such a description in the error statement described later, I refer to it. vm_info: OpenJDK 64-Bit Server VM (15.0.1+9-18) for windows-amd64 JRE (15.0.1+9-18)
I am using Intel iJIDEA Ultimate as an editor, and since there was neither jdk nor jre at the time of installation, I installed the newest one according to the instructions of IDEA.
AWTGraphics.java
import java.awt.*;
public class AWTGraphics extends Canvas
{
static final int WORLD_W = 320;
static final int WORLD_H = 240;
public void paint(Graphics g)
{
g.setColor(Color.red);
g.drawLine(0, 0, WORLD_W, WORLD_H);
g.setFont(new Font("Dialog", Font.PLAIN, 20));
g.drawString("Hello, awt!", 0, WORLD_H / 2);
}
public static void main(String[] args)
{
Frame frame = new Frame("AWTGraphics");
frame.setBackground(Color.black);
AWTGraphics canvas = new AWTGraphics();
canvas.setPreferredSize(new Dimension(WORLD_W, WORLD_H));
frame.add(canvas);
frame.pack();
frame.setVisible(true);
}
}
hs_err_pid4364.log
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff83d8902ae, pid=4364, tid=2572
#
# JRE version: OpenJDK Runtime Environment (15.0.1+9) (build 15.0.1+9-18)
# Java VM: OpenJDK 64-Bit Server VM (15.0.1+9-18, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C [awt.dll+0x902ae]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Since the error sentence is long and not very readable, only the first few lines are listed. I haven't read it properly either.
Apparently IDEA seems to be very good and outputs the stack and memory status in detail as an error log, but It has little to do with it.
Is it here to pay attention to?
# C [awt.dll+0x902ae]
Apparently, the file in this JRE called "awt.dll + 0x902ae" is doing something wrong. However, since it is a .dll located in the "/ bin" directory of JRE, you probably cannot directly rewrite this file.
However, this will result in encoding with Windows-31j when executing all projects, which may be troublesome later. (I don't know the details, but I think it is preferable to encode in UTF-8 unless there is a specific reason.)
In that case, it may be better to change only Project Encoding.
With your favorite command line tool
java -Dfile.encoding=windows-31j AWTGraphics
I think there are several ways to change the file encoding. As you like.
https://qiita.com/solabito331/items/fad5a1eea3176aadd9f7
https://teratail.com/questions/260615
https://stackoverflow.com/questions/6448163/a-fatal-error-has-been-detected-by-the-java-runtime-environment-sigsegv-libjvm
https://teratail.com/questions/297104 ↑ This is the method I actually tried and solved.
Recommended Posts