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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:52:26+00:00 2026-06-03T22:52:26+00:00

I have a tricky question. My java program is doing in a loop such

  • 0

I have a tricky question.

My java program is doing in a loop such things:

loop:

  1. read external file with compiled java class into byte[] array.

  2. create a new instance of my own classloader.

  3. setbytes from the readed file to this instance of classloader.

  4. using created classloader create a new instance of object of the class from external file.

  5. call any method of the created object.

And where the problem is.

  1. When I run this program in debug mode it behaves as I expect, so if external file changed classloader loads new version of class and executes new version (if file didn’t change it loads old version also of course).

  2. But when I run this program NOT in a debug mode it always executes old version despite the fact that the readed file has changed.

Maybe someone with a deeper knowledge of classloading issues and JVM behaviours can explain me this behaviour.

  • 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-03T22:52:27+00:00Added an answer on June 3, 2026 at 10:52 pm

    Here’s a simplified version of what happens:

    1. The JVM loads classes and other resources into the classpath exactly once (unless running in debug mode) from the directories or Jars specified in the CLASSPATH environment variable.
    2. To do this, it uses ClassLoaders
    3. Once a resource has been loaded by a ClassLoader instance, it remains in memory until the ClassLoader is garbage collected.

    The debug mode is a special mode provided by the JVM, and the classloader works harder to give you the latest version of the resource.

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

Sidebar

Related Questions

I have a tricky question that I've looked into a couple of times without
I have a tricky question. As everyone knows, Apple clearly says that ONE UIViewController
I have what I think is a tricky question, but hopefully someone on here
here's a tricky question... I have default styled input fields (no css added, just
I have the following tricky problem: I have implemented a (rather complicated) class which
I have an xml file which describes (among other things) elements with attribute values
I am trying to unload a dll in java. I have read this and
I have a tricky question regarding to what i'm trying to do. I have
I have a tricky question regarding shallow serialization of List of objects my entities
A little question regarding performance in a Java web app. Let's assume I have

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.