为什么我运行这个程序时没有弹出一个框架?约格尔
我所做的只是运行 AWT 并显示一个窗口。但我却从 Eclipse 中得到了 JVM 错误。错误如下:
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (classFileParser.cpp:3174), pid=6688, tid=14480
# Error: ShouldNotReachHere()
#
# JRE version: 6.0_20-b02
# Java VM: Java HotSpot(TM) 64-Bit Server VM (16.3-b01 mixed mode windows-amd64 )
# An error report file with more information is saved as:
# C:\xampp\htdocs\android\FireRunn\hs_err_pid6688.log
这是运行该程序的实际代码。
import javax.media.opengl.*;
import java.awt.Color;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GLCapabilities;
public class Forest{//open forest
public static void main(String[] args)
{
Frame frame = new Frame("Hello World");
GLCapabilities glcapabilities = new GLCapabilities( );
GLCanvas glcanvas = new GLCanvas( glcapabilities );
frame.add(glcanvas );
frame.setSize(300, 300);
frame.setBackground(Color.WHITE);
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
frame.setVisible(true);
}//close forest
}
}
});
All im trying to is run an AWT and have a window show up. But instead i get a JVM error from eclipse. Error is as follows:
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (classFileParser.cpp:3174), pid=6688, tid=14480
# Error: ShouldNotReachHere()
#
# JRE version: 6.0_20-b02
# Java VM: Java HotSpot(TM) 64-Bit Server VM (16.3-b01 mixed mode windows-amd64 )
# An error report file with more information is saved as:
# C:\xampp\htdocs\android\FireRunn\hs_err_pid6688.log
And here is the actual code that runs the program.
import javax.media.opengl.*;
import java.awt.Color;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GLCapabilities;
public class Forest{//open forest
public static void main(String[] args)
{
Frame frame = new Frame("Hello World");
GLCapabilities glcapabilities = new GLCapabilities( );
GLCanvas glcanvas = new GLCanvas( glcapabilities );
frame.add(glcanvas );
frame.setSize(300, 300);
frame.setBackground(Color.WHITE);
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
frame.setVisible(true);
}//close forest
}
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎混淆了右括号。这是应该有效的最终代码:
You seemed to have mixed up your closing brackets. Here's the final code that should work: