I'm trying to create an application test (since I'm starting in java) and I have an error:
main.java
package aplicaciondejava;
public class main {
public static void main(String[] args) {
Ventana1 window=new Ventana1();
window.setTitle("Ventana1");
window.setVisible(true);
}
}
Ventana1.java
package aplicaciondejava;
public class Ventana1 extends javax.swing.JFrame {
public Ventana1() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("Salir");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(337, Short.MAX_VALUE)
.addComponent(jButton1)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(266, Short.MAX_VALUE)
.addComponent(jButton1)
.addContainerGap())
);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Ventana1().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
// End of variables declaration
}
When I try to compile it, or even without compiling it, it comes out
cannot find symbol
symbol: variable System
location: class Ventana1
----
(Alt-Enter shows hints)
I'm using jdk: /
NetBeans IDE 8.2
If I press build and open the java it works correctly, but in the IDE I get redrawn in red and it does not give me writing suggestions, it would be normal when I write System.o I would have to leave a list of suggestions, and It makes me uncomfortable and not pleasant to see an error that is not an error