My icons are not being added to . JAR

Asked

Viewed 81 times

0

Good afternoon, I’m having a problem when compiling my application.

I’m using Apache Netbeans 11.0 Java 8

I’m having trouble setting an image on a Jlabel.

Call me back Expection in thread "AWT-Eventqueue-0" java.lang.Nullpointerexception at javax.swing.Imageicon.(Imageicon:217) at br.house.main.mainBotPainel.initComponents(mainBotPainel.java:63) ...

All images have been added to the Assets folder. See attachment 2 prints.

As nothing worked, I took the . JAR and I had it opened with Winrar and inside it did not contain the Assets folder, that is, it was not encapsulated together with the JAR by Netbeans. What I’m doing wrong?

As imagens e ícones foram add na pasta assets

A linha de código aonde ocorre o erro

1 answer

1

I got help in GUJ to solve the problem and I come here to share if in the future someone is going through the same problem.

I was asked by a GUJ user to post the expanded tree of my project’s 'Files' tab in the Netbeans IDE.

árvore expandida da aba Files

I received the following solution after the above print.

"Cool, your problem is not Netbeans, much less Java, but its folder structure. This is a Maven project, so you have to follow a certain folder structure (not to keep changing pom.xml).

Your Java fonts are already on the right place, which is the following folder:

src main java Your images and other Sources need to be in the following folder:

src main Resources Then create this folder and move the Assets folder into it that will work."

And it was potato. Problem solved!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.