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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:25:17+00:00 2026-05-27T18:25:17+00:00

The way I see it, (correct me if I’m wrong) a class is cached,

  • 0

The way I see it, (correct me if I’m wrong) a class is cached, so that the need to search the class path is only necessary the first time the class is referenced. It will only happen as often as the static initializer is called, which is only one time during the life cycle of the program. (or more specifically, the Class Loader)

But in the case of a large, long-life program that includes many many libraries that may or may not be used.

Do the Jar files get loaded into memory, causing unnecessary usage due to the fact that most of the classes are never used? Will it stay in Memory?

Is referencing a directory a better option? Or is the Jar file already unzipped into a temporary location to begin with?

Is it faster to use the directory method than the Jar file method?

Is it reasonable to extract all Jar files into a single directory, to reduce the number of locations in the class path? When is this a good idea?

  • 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-05-27T18:25:18+00:00Added an answer on May 27, 2026 at 6:25 pm

    The jar file central directories (placed at the end of zips) will be parsed and loaded into memory. The directory is flat so all of it needs to be loaded. A significant part of the delay when starting a simple Java process is the opening of rt.jar which is huge. So, yes that’s start up time and memory overhead right there.

    Look up for each class should be constant time. However, there are some O(n) algorithms there. So for an application as a whole that O(n^2) for class loading (although the constant is quite small and may well be dominated by linear time operations).

    Doing file access on loads of files will be inefficient. The JDK was using a zip for system classes before jars.

    (Class loading may happen some time before static initialisation when the static initialiser will be run if present – see three-argument Class.forName.)

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

Sidebar

Related Questions

Given that this is the correct way to see if 'this' has class 'selected':
Is there a way to see users that have certain security role assigned? I'm
Is there a way to see the messages that RIA services/clients send?
Looking around the docs I cannot see a correct way to go about this.
Is there a way to get a reliable machine time that cannot be altered
I'm not quite sure on the correct way to see if a row exists
Somebody correct me if im wrong. There is no way (at least no supported
So the way I see zend paginate work is that you do: $paginator =
Is there any way to see an overview of what kind of queries are
Is there a way to see, via hex editor or otherwise, if data in

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.