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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:09:02+00:00 2026-06-04T19:09:02+00:00

When I run my program from eclipse, it runs fine with very little load

  • 0

When I run my program from eclipse, it runs fine with very little load on the CPU. JProfiler (watching the program run from eclipse) says most is taken up by collision detection and drawing. When JProfiler is watching the compiled jar run, 97% of it’s cpu use comes from drawImage. It’s running around twice – three times as fast in eclipse.

Why is this?

This loads once to get the images off of a sprite sheet (All images are buffered images)

SpriteMan(Map xMap, Board xBoard)
    {
        mMap = xMap;
        mBoard = xBoard;
        try
        {
            bigImg = ImageIO.read(new File("sprites.PNG"));
            background = ImageIO.read(new File("background.PNG"));
        }
        catch (IOException e) 
        {
            System.err.println("Caught IOException: " + e.getMessage());
        }

        for (int i = 0; i < rows; i++)
        {
            for (int j = 0; j < cols; j++)
            {
                sprites[i][j] = bigImg.getSubimage(i * width,j * height,width,height);

                iSprites[i][j] = config.createCompatibleImage(width, height, Transparency.TRANSLUCENT);
                //iSprites[i][j] = toImage(sprites[i][j]);

                for(int x = 0; x<32; x++)
                {
                    for(int y = 0; y<32; y++)
                    {
                        iSprites[i][j].setRGB(x, y, sprites[i][j].getRGB(x,y));
                    }
                }

                loadedImage+=1;

            }
        }

    }

After this, the sprites are saved to their corresponding objects
(also only called once)

BlockGround(Map xMap, int X, int Y)
    {
        super(xMap, X, Y);

        mSprite = mMap.mBoard.mSpriteMan.sprites[0][0];
        mCollidable = true;
        mChar = 'G';
    }

The blocks are drawn using:

g2.drawImage(mSprite,null, x, y);

EDIT—–
Thank you so much! The program runs normally now (After updating my JRE) although I seem to have messed something up and it took a lot of fiddling to get eclipse running again, but hey, it works!

  • 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-04T19:09:04+00:00Added an answer on June 4, 2026 at 7:09 pm

    Did you upload the jar to a webserver by any chance? If so, the slowdown may be caused by that server.

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

Sidebar

Related Questions

I have a simple java program that runs fine in eclipse but cannot find
When I run a program from Eclipse, the emulator appears with a padlock on
I am trying run a program from a qmake .pro file which modifies the
Is there a well-designed method that can run my ruby program from anywhere? I
When I run my program (which decrypts a paragraph from a certain document), I
I have to run some other application from my program and hide it's form.
How do you run a java program that requires input from a file in
I'm writing a program to be run from the Linux user space which spawns
I need to run this line from my c++ program: java -jar test.jar text1
I want to run the following command from a C program to read 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.