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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:24:32+00:00 2026-06-17T09:24:32+00:00

I run a java application packaged in A.jar, in which some classes in B.jar

  • 0

I run a java application packaged in A.jar, in which some classes in B.jar are used.

All related jars are placed in a specific directory, which is included in the classpath.

The program is like this:

main(){

    run method ClassA.M1() in A.jar;  //the method may keep running for 2 minutes

    do some other prepare;

    call method ClassB.M2 in B.jar;

}

When the program is running M1, I manually replaced B.jar with a newer version(the name is also B.jar).

But, the program throw ClassNotFoundException.

Then, start the program again, and it works fine.

so, my question is: why the ClassNotFoundException is thrown, as the jar path and jar name is not changed, the classloader should load it without any troubles.

Give me some directions please.

  • 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-17T09:24:33+00:00Added an answer on June 17, 2026 at 9:24 am

    You cannot simply change jar files during runtime by replacing them with ones having the same name, because the class loader might have already loaded some classes from it.

    If you need to support such behavior, you need to look into libraries or frameworks that would provide hot replace mechanisms.

    Here are two articles to help you understand class loaders better:

    • The Basics of Java Class Loaders
      (1996)
    • Understanding the Java ClassLoader
      (2001)

    There are plenty more articles on this subject and even related questions here on the Stack OverFlow, I recommend you read more.

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

Sidebar

Related Questions

I have developed a java application which run's perfectly in local server. But When
We have a java application which run as server running on a remote windows
I'm developing a java application which will run on LAN, i do test today
I have a JAR myapp-logic with classes, some of which are obfuscated and some
My main application is written in Java, which has Main.jar. I am preparing final
I have written a standalone Java application that I've packaged into a jar file
I have written a Java program which I package and run from a JAR
When I run my java web application from eclipse using tomcat server, system gets
I'm trying to run a Java Jetty application and I keep seeing this error:
On my system I can't run a simple Java application that start a process.

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.