Java Swing - Fix Location is null exception
Вставка
- Опубліковано 19 вер 2024
- In This video, I will show to how to fix:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.net.URL.toExternalForm()" because "location" is null
Your solution has saved me.
Thank you very much Sir, a big hug from Costa Rica.
I wasted at least a day to figure out solution for this issue. So I though why not make a short video to help others when they need. I am pleased it helped you.
OMG, thank you so much. you just saved my grades
Thank you for your video ! You're make my day ! I'm happy, very very very super happy !! I have to tell my friend with about your channel , channel Your is Great !!
finally this solved my problem, thx for the video codeX
Many Thanks...Working for me with Maven Project and Desktop Application with Java
Thankkkkkkk youuuuuu
thank you brooo
Hi, I'm working on a project with maven and I know the path changes and will like to know if there's anyway to make it work to an icon that i want to put on the jframe; this was really helpfull, thanks a lot
Thank you so muchhh
gracias amigo :D
Thanks!
Thanks a lot!
What if the image is the icon of the proyect?
I have not tried this solution with project icon. I will try snd feed back shortly
does it work on windows?
This demonstration is on windows PC. This approach is also platform independent.
labelName.setIcon(new javax.swing.ImageIcon(System.getProperty("user.dir")+"\\src\\main\\java\\img\\imglogin1.png"));
here is the king
You're the King, thanks Sir
the project can run on another pc right?
Yes project can run on any pc, as long as it equipped with JVM.