Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7828703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:27:02+00:00 2026-06-02T10:27:02+00:00

Please excuse my limited understanding of Java Webstart as I’m very new into this.

  • 0

Please excuse my limited understanding of Java Webstart as I’m very new into this.

So I got my app working in a JAR file on my computer, using this snippet in a static method (class extends JFrame):

ImageIcon image = new javax.swing.ImageIcon(window.getClass().getResource("/resources/img/loginWindowTop.jpg"));
//ImageIcon image = new ImageIcon(window.getClass().getResource("/resources/img/loginWindowTop.jpg")); // tried this too
JLabel imageLabel = new JLabel(image);
imageLabel.setBounds(rect);
window.add(imageLabel);

It works when launching the app on my computer directly from the JAR file. When testing from the web server with a JNLP file, the app crashes showing this:

java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at gui.LoginWindow.create(LoginWindow.java:42)
at main.Starter.main(Starter.java:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

I would really appreciate if someone could explain what to do. I’ve searched quite a time on the internet and no solution could help me (yet). I hope it’s not because I’m working with a static JFrame (called window in my snippet)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T10:27:04+00:00Added an answer on June 2, 2026 at 10:27 am

    Thanks to your hints, I finally found a way to do it. As my class LoginWindow is only used in a static way, I had to use

    ImageIcon image = new ImageIcon(LoginWindow.class.getResource("/resources/img/loginWindowTop.jpg"));
    

    LoginWindow.getClass() would only work in a non-static way.

    Thank you all for your input and I hope this helps other people too!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to jquery so please excuse me if this question seems silly...
I'm new to C# and WinForms so please excuse me is this is a
I'm still very new to cocoa touch so please excuse any terminology that I
Please excuse my ignorance, im very new to windows. Windows 7 64bit Point Grey
Please excuse this numpty question, but when I do ChannelFuture future = channel.write(message); future.addListener(new
I'm new to EF so please excuse me if this is a noob question.
I am new to python and numpy so please excuse me if this problem
Please excuse me if this is a very novice question, but I am little
I am very new to programming so please excuse me if there is an
Please excuse me if this is a very simple solution or stupid mistake -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.