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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:29:13+00:00 2026-06-06T09:29:13+00:00

I am running my project on NetBeans but I am not able to run

  • 0

I am running my project on NetBeans but I am not able to run .jar file successfully.
1 . I was developing my project using Java Class library , and then later found there is some problem in manifest files . .
2. Then to solve above problem I created project as JavaApplication project, now manifest looks like this

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.3
Created-By: 1.6.0_22-b22 (Sun Microsystems Inc.)
Class-Path: 
Main-Class: gameloftbraker.GameLoftBraker

on terminal it throws following exception:

Exception in thread "main" java.lang.NullPointerException
    at javax.swing.ImageIcon.<init>(ImageIcon.java:204)
    at gameloftbraker.Ball.<init>(Ball.java:26)
    at gameloftbraker.Arena.gameInit(Arena.java:71)
    at gameloftbraker.Arena.addNotify(Arena.java:67)
    at java.awt.Container.addNotify(Container.java:2584)
    at javax.swing.JComponent.addNotify(JComponent.java:4687)
    at java.awt.Container.addNotify(Container.java:2584)
    at javax.swing.JComponent.addNotify(JComponent.java:4687)
    at java.awt.Container.addNotify(Container.java:2584)
    at javax.swing.JComponent.addNotify(JComponent.java:4687)
    at javax.swing.JRootPane.addNotify(JRootPane.java:754)
    at java.awt.Container.addNotify(Container.java:2584)
    at java.awt.Window.addNotify(Window.java:707)

Thanks for help in advance. I hope I am not missing anything. There is no problem in code as it build and runs successfully , If code is needed let me know .

Ball.java

////////////////
package gameloftbraker;

import javax.swing.ImageIcon;

public class Ball extends Graphc implements Commn {

    protected String ball = "../images/ball.png"; //address to ball graphic
    protected int xdir;      

    protected int ydir;

    public Ball(){  
        xdir =  2;
        ydir = -2;

        ImageIcon img = new ImageIcon(this.getClass().getResource(ball));
        image = img.getImage();

        height = image.getHeight(null);
        width = image.getWidth(null);

        resetState();
    }
// rest of the functions * it works perfectly as project but unable to run in .jar
}
  • 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-06T09:29:15+00:00Added an answer on June 6, 2026 at 9:29 am

    It would help if you’d show us the code for Ball, highlighting the lines shown in the stacktrace… but my guess is that you haven’t bundled the graphics for your game into the jar file correctly.

    One thing to point out:

    There is no problem in code as it build and runs successfully

    Well it’s not running successfully now, is it? Building and running successfully in one environment doesn’t mean there’s no problem in the code. For example, you could have hard-coded filenames in there which aren’t present on any other machine – I’m not suggesting that actually is the case here, I’m just saying that “works on my machine” isn’t proof that there’s no problem in the code.

    EDIT: Now that we can see your code, it looks like ball.png may not be in the jar file. Or the problem is your use of .. in a resource name. Try changing the resource name to:

    // TODO: Make this private static final unless you have any reason not to...
    protected String ball = "/images/ball.png";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running phpunit tests with zendframework using netbeans but the reports are not being
I have a Netbeans Platform modular project, not a regular Java project. I want
I'm using netbeans, project: 'maven OSGI bundle', i have bundle activator running fine in
I've got Hudson running on TOMCAT, it can build my Netbeans project using the
I made a java application.and bundled all classes in jar file..wen i run the
I've got a project running and we're using SVN as the version control. There
I am using Eclipse Maven (m2e) inside Eclipse and I am running my project
My current task is taking a Java project written and developed in Ubuntu NetBeans
I'm doing my first Java EE web application using glassfish and netbeans. When I
I have a Java project where I am pulling tweets from twitter using the

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.