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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:52:04+00:00 2026-05-26T22:52:04+00:00

So I have a fairly complex applet structure from a couple years back, and

  • 0

So I have a fairly complex applet structure from a couple years back, and I have a question about a global class that is in it. Basically, I have three applets on the same page and they interact with each other in different ways. The part I’m confused about is the fact that they all share global (static) variables from the same class. How exactly is this happening? I was under the impression that each applet would have its own little environment and would thus be unable to access the same static variables as the others? For example if I have this in applet A:

Globals.globalVar = 5;

And this in applet B:

int x = Globals.globalVar;

And I ensure that B starts AFTER A then x will become 5. I would like to know how exactly this is handled in the JVM, as it doesn’t quite make any sense to me. Does this behaviour imply that if you have two separate java applications running at the same time they can access each others static variables? Thanks beforehand.

  • 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-26T22:52:05+00:00Added an answer on May 26, 2026 at 10:52 pm

    Because that’s how it’s defined, for backward-compatibility reasons. See http://download.oracle.com/javase/6/docs/technotes/guides/jweb/applet/applet_execution.html#cache:

    Normally, if two applets have the same codebase and archive
    parameters, they will be loaded by the same class loader instance.
    This behavior is required for backward compatibility, and is relied on
    by several real-world applications. The result is that multiple
    applets on the same web page may access each others’ static variables
    at the Java language level, effectively allowing the multiple applets
    to be written as though they comprised a single application.

    While this feature enables certain kinds of applications to be
    conveniently written, it has certain drawbacks. It interferes with
    termination of applets, in particular when multiple instances of the
    same applet are active. It makes the programming model for applets
    more complex, since it is under specified exactly when the static
    fields of an applet will be re-initialized, and when they will be
    maintained from run to run of the same applet. It causes imprecise
    behavior of certain user interface operations within the Java Plug-in
    due to the inability to identify exactly which applet initiated a
    particular request.

    For this reason, the new Java Plug-in provides a way to opt out of the
    use of the classloader cache on an applet by applet basis.

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

Sidebar

Related Questions

I have a fairly complex procedure that currently takes about 1:30 (min:sec) to complete.
I have a fairly complex method in my controller that basically outputs data to
I have a fairly complex SQL query that pulls different types of products from
I have a fairly complex view that points back to other pages within my
I have a fairly complex multi threaded application (server) that from time to time
I have a fairly complex set of C++ classes that are re-written from Java.
I have a fat GUI that it getting fairly complex, and I would like
I have a web page that I use to update a fairly complex data
I have a fairly complex business application written in ASP.NET that is deployed on
I have a fairly complex model needing to be validated, the problem is that

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.