Theoretical limit for maximum heap size on 32 bit JVM is 2^32 (4GB) and for 64 bit JVM is 2^64 (16EB).

As no system currently have 2^64 bit of physical memory or RAM, so the maximum heap allocation depends on how much your operating system allows.

A 32 bit JVM running on x32 Windows operating system with 4GB has limitation to use less than 2GB as heap memory and this is due to the JVM that tries to allocate the heap as a contiguous memory chunk and windows seems to reserves around 2GB for its own & user processes. However in Linux or Solaris, one can set maximum heap space, more than 2GB and less than max memory and memory allocated to operating system.

To validate the maximum heap that can be allocated:

        1)    Create a file named “MemoryUtil.java” with the below code
            
               public class MemoryUtil{ 
                  private static final int MegaBytes = 10241024;

                  public static void main(String args[]) { 
                     long totalMemory = Runtime.getRuntime().totalMemory()/MegaBytes;
                     long maxMemory = Runtime.getRuntime().maxMemory()/MegaBytes;
                     long freeMemory = Runtime.getRuntime().freeMemory()/MegaBytes;

                     System.out.println("JVM totalMemory also = initial heap size of JVM : "  + totalMemory);
                     System.out.println("JVM maxMemory also = maximum heap size of JVM: "  + maxMemory);
                     System.out.println("JVM freeMemory: " + freeMemory); 
                 }
            }

        2)    Change the value for “-xms” as required and execute the below command to validate the max memory that can you used on the machine

                ${JAVA_HOME}/bin/java -XX:PermSize=128M -XX:MaxPermSize=256M -Xms512m -Xmx3500m MemoryUtil


In the Java programming language, all source code is first written in plain text files ending with the .java extension. Those source files are then compiled into .class files by java compiler, using the below command or java tool:
      “Javac MyProgram.java”

A .class file does not contain code that is native to your processor; it instead contains bytecodes. Bytecode is the intermediate representation of Java programs just as assembler is the intermediate representation of C or C++ programs; it is also represented as the machine language of the Java Virtual Machine (Java VM).





The java launcher tool then runs your program with an instance of the Java Virtual Machine. Java Virtual Machine is responsible to convert your bytecode to machine specific code that are native to your processor. Below is the java launcher tool or command to run your program:
      “Java MyProgram”




JVM is bundled with JDK and JRE binaries, as stated in the previous section and it is responsible to convert your bytecode to machine specific code. Since the machine code would differs for each operating system we have different JDK and JRE installable for Microsoft Windows, the Solaris™ Operating System (Solaris OS), Linux, or Mac OS.

Everyone would have heard about "Write once, run anywhere" (WORA), or sometimes write once, run everywhere (WORE) terminology in java, it is a slogan created by Sun Microsystems to illustrate the cross-platform benefits of the Java language. Ideally, this means Java can be developed on any device, compiled into a standard bytecode and be expected to run on any device equipped with a Java virtual machine (JVM). Thus if the java program/.java file is compiled into bytecode/.class file it can you executed on any Operation System provided JDK or JRE or JVM is installed on that machine.


Name
Acronym
Explanation
Java Development Kit
JDK
The software for programmers who want
to write Java programs
Java Runtime Environment
JRE
The software for consumers who want to
run Java programs
Standard Edition
SE
The Java platform for use on desktops and
simple server applications
Enterprise Edition
EE
The Java platform for complex server
applications
Micro Edition
ME
The Java platform for use on cell phones
and other small devices
Java 2
J2
An outdated term that described Java
versions from 1998 until 2006
Software Development Kit
SDK
An outdated term that described the JDK
from 1998 until 2006
Update
u
Sun’s term for a bug fix release

Java SE Naming and Versions
The Java Platform name has changed a few times over the years.
Java was first released in January 1996 and was named Java Development Kit, abbreviated JDK.
Version 1.2 was a large change in the platform and was therefore rebranded as Java 2. Full name: Java 2 Software Development Kit, abbreviated to Java 2 SDK or J2SDK.
Version 1.5 was released in 2004 as J2SDK 5.0 –dropping the “1.” from the official name and was further renamed in 2006.
Starting with Tiger (J2SDK 5.0), each version has two version numbers: an internal number, such as 1.5.0, and an external number, such as 5.0.

Sun simplified the platform name to better reflect the level of maturity, stability, scalability, and security built into the Java platform. Sun dropped the "2" from the name. The development kit reverted back to the name "JDK" from "Java 2 SDK". The runtime environment has reverted back to "JRE" from "J2RE."
JDK 6 and above versions, no longer use the “dot number” at the end of the platform version.
When invoking the “java-version” command the result includes the version string with its update version number. When the version string for the product is reported as "java version 1.7.0_3", the product will be called JDK 7u3, JDK 7 update 3 or, when the update version is not important, JDK 7.


When invoking the “java –fullversion” command, the result also includes the build number, a level of detail not needed by most users. When the version string for the product is reported as "java version 1.7.0_3-b04", where” b” means “build”.
Java Runtime Environment (JRE) is meant for users to run applets and Java program and it is also developed as browser plugin to run any Java program from browser like Internet Explorer, Mozilla Firefox or Google Chrome, you need JRE to be installed in your machine and should be enable on your browser as well.


Java Development Kit (JDK) is meant for programmers for developing applets and applications. It is a superset of JRE, and contains everything that is in the JRE, plus tools such as the compilers and debuggers necessary for developers for development and troubleshooting.


Java Virtual Machine (JVM) is a specification that provides runtime environment in which java byte code is converted into machine specific code and executed. JVM is at heart of Java programming language and provide several features to Java programmer including Memory Management and Garbage Collection, Security and others.

We have different JVM for Windows, Linux or Solaris, as the byte code needs to be converted into machine code, which is platform dependent. However one JAR can run on all these operating system, as the JAR would contain the java byte code which can be interpreted by JVM on any platform.

There are different JVM implementations, namely Client VM and Server VM. These may differs in things like performance, reliability, speed, etc. These implementations will differ in those areas where Java specification doesn’t mention how to implement the features, like how the garbage collection process works is JVM dependent, Java spec doesn’t define any specific way to do this system level service.

The client VM is tuned for reducing start-up time and memory footprint suitable for client environment whereas server VM is designed for maximum program execution speed that is intended for running long-running server applications where fastest possible operating speed is generally more important than having the fastest possible start-up time.

JVM automatically selects Server VM implementation on “server-class” systems, defined as “at least 2 CPUs and at least 2 GB of physical memory.” However, the JVM bundled with JRE for Microsoft Windows platforms includes only the Client VM.

In short here are few basic differences between JRE, JDK and JVM:

        1) JRE and JDK come as installer while JVM are bundled with them.
        2) JVM is created when you execute Java program by giving “java” command.
        3) JRE is for users, JDK is for developers and JVM provides runtime environment.
There are four platforms of the Java programming language:
1.    Java Platform, Standard Edition (Java SE)
2.    Java Platform, Enterprise Edition (Java EE)
3.    Java Platform, Micro Edition (Java ME)
4.    JavaFX

All Java platforms consist of a Java Virtual Machine (VM) and an application programming interface (API). The Java Virtual Machine is a program, for a particular hardware and software platform, which provides runtime environment in which java byte code is converted into machine specific code for program execution. An API is a collection of software components that is used to create other software components or applications.


Java SE

Oracle has two products that implement the Java SE 7 platform: JDK 7 (Java™ SE Development Kit 7) and JRE 7 (Java™ SE Runtime Environment 7).

When most people think of the Java programming language, they think of the Java SE API. Java SE's API provides the core functionality of the Java programming language. It defines everything from the basic types and objects of the Java programming language to high-level classes that are used for networking, security, database access, graphical user interface (GUI) development, and XML parsing.

In addition to the core API, the Java SE platform consists of development tools, deployment technologies, and other class libraries and toolkits commonly used in Java technology applications.


The Java EE platform is built on top of the Java SE platform. The Java EE platform provides an API and runtime environment for developing and running large-scale, multi-tiered, scalable, reliable, and secure network applications.

The Java ME platform provides an API and a small-footprint virtual machine for running Java programming language applications on small devices, like mobile phones. The API is a subset of the Java SE API, along with special class libraries useful for small device application development. Java ME applications are often clients of Java EE platform services.


JavaFX is a platform for creating rich internet applications using a lightweight user-interface API. JavaFX applications use hardware-accelerated graphics and media engines to take advantage of higher-performance clients and a modern look-and-feel as well as high-level APIs for connecting to networked data sources. JavaFX applications may be clients of Java EE platform services.