soy nuevo en la programación, y he estado tratando de simplemente hacer que netbeans corra un jlabel con una imagen, pero siempre que intento poner imagenes que esten dentro del mismo proyecto, la unica forma para añadir imagenes que tengo es por medio de la opcion external image, pero quiero aprender a solucionarlo ya que veo que en cualquier tutorial que veo de youtube no les suelta el error No he añadido nada de codigo, he usado las opciones que me suelta el mismo netbeans para diseñar Asi es como tengo las carpetas, siendo en folder donde esta la imagen que intento cargar desde un jlabel con la propiedad icon [![][1]][1] [![introducir la descripción de la imagen aquí][2]][2] [1]: https://i.sstatic.net/g2GzD.png [2]: https://i.sstatic.net/m9jad.png Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts. Scanning for projects... ------------------------------------------------------------------------ Building mavenproject2 1.0-SNAPSHOT ------------------------------------------------------------------------ --- exec-maven-plugin:1.5.0:exec (default-cli) @ mavenproject2 --- Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at java.desktop/javax.swing.ImageIcon.<init>(ImageIcon.java:217) at Plogin.login.initComponents(login.java:34) at Plogin.login.<init>(login.java:18) at Plogin.login$1.run(login.java:86) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764) at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:97) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:717) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:711) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:734) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:199) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) ------------------------------------------------------------------------ BUILD SUCCESS ------------------------------------------------------------------------ Total time: 5.596 s Finished at: 2020-09-08T09:57:23-05:00 Final Memory: 7M/25M ------------------------------------------------------------------------ Siendo este el error que me sale Nota: no he añadido nada de código y todo lo que he hecho fue en base a tutoriales donde si funcionaba Fichero de login /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Plogin; /** * * @author elias */ public class login extends javax.swing.JFrame { /** * Creates new form login */ public login() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/folder/coronavirus_PNG6.png"))); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(58, 58, 58) .addComponent(jLabel1) .addContainerGap(74, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(33, 33, 33) .addComponent(jLabel1) .addContainerGap(104, Short.MAX_VALUE)) ); pack(); }// </editor-fold> /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new login().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JLabel jLabel1; // End of variables declaration }