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 8958391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:12:09+00:00 2026-06-15T15:12:09+00:00

Well, I’m trying to set up my icon image, and I keep getting this

  • 0

Well, I’m trying to set up my icon image, and I keep getting this error….

Code:

public static void browser(){
        Image myicon = null;
        myicon.equals("images/icon.gif");
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (ClassNotFoundException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        } catch (InstantiationException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        } catch (IllegalAccessException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        } catch (UnsupportedLookAndFeelException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        JFrame frame = new JFrame("Kloke - Become invisable.");
        frame.setSize(350, 100);
        frame.setResizable(false);
        frame.setIconImage(myicon);

Error:

Exception in thread "main" java.lang.NullPointerException
        at web.browser(web.java:14)
        at Checkupdate.main(Checkupdate.java:102)

PS. I am new to java, so feel free to treat me as if I have no idea what I am doing(PSS Line 14 is where I initialize the ‘myicon’ variable.)

  • 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-15T15:12:11+00:00Added an answer on June 15, 2026 at 3:12 pm

    Attempting to call any instance method on an object that has not been instantiated will cause a NullPointerException. You need to instantiate myicon

    Image myicon = ImageIO.read(new File("images/icon.gif"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well, I was trying to fix this program, and I keep getting the errors
Well, I'm trying to reuse a portion of C# code. It's an abstract class
Well the problem is that I was using code like this: new Date().toJSON().slice(0, 10)
Well I enter: Chesslounge.net as the url and I keep getting access denied when
well i have a configuration like this in the components part of my config
well, I am trying to include a header file in my project, while the
Well, i want house image to rotate from -5° to 5° and i wrote
Well,This thing has bugged me for days. I have developed an app that checks
Well here is what I'm trying to do. I want to convert a array
Well, I have GridView with editable field like 'TemplateField' with DropDownList. My code: <Columns>

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.