Gần đây tôi đã thực hiện một dự án Netbeans và tôi đang sử dụng SVN cùng với nó. Tôi nhìn thấy lỗi lớp trùng lặp, và trong giao diện điều khiển nó nóiphải gọi super() lỗi trong Netbeans
java.lang.VerifyError: (class: pie/chart/explorer/PieChartExplorer, method: <init> signature:()V) Constructor must call super() or this()
Could not find the main class: pie.chart.explorer.PieChartExplorer. Program will exit.
Exception in thread "main" Java Result: 1
Đây là PieChartExplorer.java:
package pie.chart.explorer;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class PieChartExplorer extends JFrame implements ActionListener {
JTextField one = new JTextField(10);
JTextField two = new JTextField(10);
JTextField three = new JTextField(10);
JButton sub = new JButton("Click to be amazed");
public PieChartExplorer() {
super("Pie Chart Explorer");
setSize(300,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
FlowLayout flo = new FlowLayout();
setLayout(flo);
setVisible(true);
add(one);
add(two);
add(three);
sub.addActionListener(this);;
add(sub);
}
public static void main(String[] args) {
PieChartExplorer app = new PieChartExplorer();
}
@Override
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if(source == sub) {
try {
Pie show = new Pie(Float.parseFloat(one.getText()),Float.parseFloat(two.getText()),Float.parseFloat(three.getText()));
} catch(Exception ex) {
JOptionPane.showMessageDialog(this, "Please check entered data");
}
}
}
}
Tôi đã thử:
- sạch và Rebuild dự án
- Đảm bảo rằng tôi đã gọi là siêu trong tất cả các nhà xây dựng
Làm cách nào để khắc phục sự cố này? Code for download.
Can bạn qua thông báo lỗi đầy đủ? Có bất kỳ thông tin về tệp, lớp hoặc dòng nào không? –
@eyazici Tôi đã bao gồm thông báo lỗi trong bản chỉnh sửa của mình. Vui lòng xem thông tin cập nhật –
@Andrew: Lỗi bạn đã đăng trông giống như lỗi thời gian chạy. Bạn có gặp lỗi xây dựng không? Đăng chi tiết về lỗi "lớp trùng lặp" mà bạn đã đề cập. – Gabe