Since every client who is accessing a java application has a JRE that consists JVM. So
What does JVM of every client store? Does it store objects as JVM of Server?
In a running web application which is being accessed by thousands of users, when a user accesses it, do the classes get loaded for every particular user (as every JRE has a classloader) or the classes are already loaded in Server's JVM?
The question makes no sense. Clients are not necessarily running Java and therefore have no need of either JRE or JVM (which are 2 different things). A client can be a web browser written in C, for example.
A JVM is a Java Virtual Machine. It is a program that runs Java code. A JRE is a Java Runtime Environment and it's the JVM program file, plus all of the other support files needed to run Java, including the core classes.
A Java web server is probably not running under a JRE, however. It usually requires the full Java Developer's Kit (JDK). While recent changes by Oracle are breaking this long distinction, traditionally, a JDK had a JRE embedded within it, but added the necessary extra files such as the Java compiler itself, which isn't part of a traditional JRE.
A Java web server contains multiple classpaths. There will be one for each deployed web application, one for the server itself, and often one or more for various server internal subsystems. Each classpath component anchors it own class instances. The webapp classpaths actually extend the core server classpath, so there will be one and only one instance of the class java.lang.String for all classpaths (Note that this is the class, I'm not talking about Stringinstances!).
But if, for example, you had 2 webapps using log4j, that would come from their unique classpaths build from their WEB-INF/classes and WEB-INF/libs directories, so there'd be separate copies of the log4 classes in each webapp.
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.
Arun Singh Raaj
posted 1 week ago
Thanks for responding.
I'm sorry for this stupid question, when I read JRE is required for every client machine to run java app, it was for desktop app, I misunderstood it. I got it. Thanks.
posted 1 week ago
Yes, you would have a server running a JRE, and each client would require a JRE if you pass Java® code to them. Most people, however, would only expose PHP/JS/similar code on the website, rather than Java®. If that happens, the clients woulldn't run any Java® code.
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library