最近我做了一個NetBeans項目,我與它一起使用SVN。我看到重複類錯誤,並在控制檯它說方法必須調用超()錯誤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
這裏是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");
}
}
}
}
我曾嘗試:
- 清理並重建項目
- 確保我已在所有構造函數中調用超級模塊
這怎麼解決? Code for download。
你能過去完整的錯誤消息?是否有任何文件,班級或線路信息? –
@eyazici我包括那裏的錯誤消息在我的編輯。請查看更新信息 –
@Andrew:您發佈的錯誤看起來像是運行時錯誤。你是否有構建錯誤?發佈您提到的「重複類」錯誤的詳細信息。 – Gabe