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

КОМЕНТАРІ • 22

  • @gabrielmunozrobleto8919
    @gabrielmunozrobleto8919 Рік тому +3

    Your solution has saved me.
    Thank you very much Sir, a big hug from Costa Rica.

    • @codeXtree
      @codeXtree  Рік тому +4

      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.

  • @di_mp
    @di_mp 8 місяців тому +2

    OMG, thank you so much. you just saved my grades

  • @ETorRae
    @ETorRae 10 місяців тому +1

    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 !!

  • @capitulossoloanime562
    @capitulossoloanime562 10 місяців тому +1

    finally this solved my problem, thx for the video codeX

  • @FabioGarciaRamirez
    @FabioGarciaRamirez 11 місяців тому

    Many Thanks...Working for me with Maven Project and Desktop Application with Java

  • @shellybhattacharjee1556
    @shellybhattacharjee1556 19 днів тому

    Thankkkkkkk youuuuuu

  • @febryangandanamiro685
    @febryangandanamiro685 Рік тому +1

    thank you brooo

  • @nasemelec
    @nasemelec Рік тому +1

    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

  • @mochamadriftanriasdie9537
    @mochamadriftanriasdie9537 3 місяці тому

    Thank you so muchhh

  • @anthonychoque7393
    @anthonychoque7393 Рік тому +1

    gracias amigo :D

  • @rivaru1703
    @rivaru1703 10 місяців тому

    Thanks!

  • @zwei8481
    @zwei8481 Рік тому

    Thanks a lot!

  • @renatorinconparedes6098
    @renatorinconparedes6098 Рік тому +2

    What if the image is the icon of the proyect?

    • @codeXtree
      @codeXtree  Рік тому

      I have not tried this solution with project icon. I will try snd feed back shortly

  • @adolfoherrera4749
    @adolfoherrera4749 Рік тому +1

    does it work on windows?

    • @codeXtree
      @codeXtree  Рік тому

      This demonstration is on windows PC. This approach is also platform independent.

  • @ailtonbaltazarlicas7960
    @ailtonbaltazarlicas7960 Рік тому +5

    labelName.setIcon(new javax.swing.ImageIcon(System.getProperty("user.dir")+"\\src\\main\\java\\img\\imglogin1.png"));

  • @deborahkomolafe5754
    @deborahkomolafe5754 Рік тому +1

    the project can run on another pc right?

    • @codeXtree
      @codeXtree  Рік тому

      Yes project can run on any pc, as long as it equipped with JVM.