Java:EXCEPTION_ACCESS_VIOLATION

时间:2013-01-21 14:31:11

标签: java swing

  

可能重复:
  What is the possible reason for an EXCEPTION_ACCESS_VIOLATION crash?

这是我的下面的程序,我得到了 我可以运行其他程序,但不是这个程序,请你告诉我

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000063c8d840, pid=6000, tid=3304
#
# JRE version: 7.0_04-b22
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.0-b21 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# V  [jvm.dll+0xfd840]
#
# 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:\hs_err_pid6000.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;
import java.util.Vector;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.table.DefaultTableModel;
public class Preethi {
    protected void initUI() {
        final DefaultTableModel model = new DefaultTableModel(new String[] {
                "Id", "Name", "Desg" }, 0);
        final JTable table = new JTable(model);
        // table.setFillsViewportHeight(true);
        JFrame frame = new JFrame(Preethi.class.getSimpleName());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JScrollPane scrollpane = new JScrollPane(table);
        frame.add(scrollpane, BorderLayout.CENTER);
        frame.pack();
        frame.setVisible(true);
        Vector vec = new Vector();
        vec.add("1122");
        vec.add("Iraneee");
        vec.add("Dev");
        model.insertRow(0, vec);
        model.setValueAt("1111", 0, 0);
        //model.setValueAt(new Object[]{"1111","Pavan","Developer"}, 0, 0);

    }

    public static void main(String[] args) throws ClassNotFoundException,
            InstantiationException, IllegalAccessException,
            UnsupportedLookAndFeelException {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                new Preethi().initUI();
            }
        });
    }

}

3 个答案:

答案 0 :(得分:0)

升级到适用于您平台的最新Java版本(目前是Java 7更新11),然后重试。

答案 1 :(得分:0)

你的代码在我的机器上正常运行。我有Java 6

enter image description here

答案 2 :(得分:0)

看起来你正在运行MS Windows,因为我已经看过这个或者当时遇到过。这是您可能遇到的问题的链接。

http://java.com/en/download/help/exception_access.xml

尝试更新JVM或尝试在Linux / Unix机器中运行它。