Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-2820

Importing JLabel icon on Maven project is not copying the image to the target directory

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • 9.0, 10.0, 11.0
    • None
    • apisupport - Maven
    • None
    • JDK 12, probably earlier versions too

    Description

      1. Create new Maven project
      2. Add new JFrame form in the default created package
      3. Drop a JLabel anywhere in the form
      4. Right click the JLabel, click "Properties" and go to the three dots in the right of "Icon"
      5. Choose "Import to project" and select any image. Import the image to the same package
      6. Run the project and select the JFrame to be the Main class
      7. You will end-up with a NullPointer exception with the stack trace listed below:

      Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
      {{ at java.desktop/javax.swing.ImageIcon.<init>(ImageIcon.java:217)}}
      {{ at com.mycompany.mavenproject1.NewJFrame.initComponents(NewJFrame.java:33)}}
      ...

      That is the jLabel1.setIcon(new javax.swing.ImageIcon(...) call.

      Checking the file structure - the image is correctly placed and existing in the SRC folder inside the related package subdirectory. The image is also visualized correctly in the Netbeans editor itself. It is also not related to the file name (bug is available with simple filenames too).

      The issue is that Netbeans does NOT copy the image file into the "target" directory. If I copy the file manually, it works fine.

      This happens only on Maven project.

      Attachments

        1. netbeans_maven_bug.png
          173 kB
          Philip Petrov

        Activity

          People

            Unassigned Unassigned
            philippetrov Philip Petrov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: