Izzy Nakash
Izzy Nakash

Reputation: 187

Why isnt a frame popping up when i run this program? Jogl

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
}
        }
    });

Upvotes: 0

Views: 153

Answers (1)

Katana
Katana

Reputation: 755

You seemed to have mixed up your closing brackets. Here's the final code that should work:

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);
            }
        });//close forest
        frame.setVisible(true);
    }
}

Upvotes: 1

Related Questions