这是我的第一个话题。一开始我想说我不知道代码是否正确。这段代码是我的GUI编程中的第一个,但这不是问题。当我尝试运行时出现代码错误。有没有人有同样的问题。谢谢你的帮助。代码:
import java.awt.*;
import javax.swing.*;
public class Main extends JFrame{
public Main(){
setSize(300,200);
setTitle("My Title");
}
public static void main(String[] args) {
Main frame = new Main();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
错误:
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007fff52cdfd0c, pid=6244, tid=0x0000000000000e08
> #
> # JRE version: Java(TM) SE Runtime Environment (8.0_131-b11) (build 1.8.0_131-b11)
> # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.131-b11 mixed mode windows-amd64 compressed oops)
> # Problematic frame:
> # C [d3d9.dll+0xfd0c]
> #
> # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
> #
> # An error report file with more information is saved as:
> # D:\EclipseWorkSpace\GUI8_LW_S15300\hs_err_pid6244.log
> #
> # If you would like to submit a bug report, please visit:
> # http://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.
> #
我下载了最新的Java版本。 我检查了Windows更新和硬件驱动程序。