Questions tagged [jvm]

The Java Virtual Machine (JVM) enables a set of computer software programs and data structures to use a virtual machine model for the execution of other computer programs and scripts. Use this tag for questions dealing with tools provided by a JVM or how it works in a specific scenario.

The model used by a JVM accepts a form of computer intermediate language commonly referred to as Java bytecode. This language conceptually represents the instruction set of a stack-oriented, capability architecture.

A JVM can also execute bytecode compiled from programming languages other than Java. For example, Ada source code can be compiled to execute on a JVM. JVMs can also be released by other companies besides Oracle (the developer of Java), but JVMs using the "Java" trademark may be developed by other companies as long as they adhere to the JVM specification SE 7 published by Oracle and to related contractual obligations.

List of Java and JVM Specifications 6-11

See also "Understanding Oracle Java SE Licensing".

Java was conceived with the concept of WORA - write once, run anywhere. This is done using the Java Virtual Machine (JVM).

The JVM is the environment in which Java programs execute. It is the software that is implemented on non-virtual hardware and on standard operating systems.

JVM is a crucial component of the Java platform, and because JVMs are available for many hardware and software platforms, can be both middleware and a platform in its own right, hence the trademark write once, run anywhere. The use of the same bytecode for all platforms allows Java to be described as "compile once, run anywhere", as opposed to "write once, compile anywhere", which describes cross-platform compiled languages. A JVM also enables such features as automated exception handling, which provides "root-cause" debugging information for every software error (exception), independent of the source code.

A JVM is distributed along with a set of standard class libraries that implement the Java Application Programming Interface (API). Appropriate APIs bundled together form the Java Runtime Environment ().

Online Resources

  1. JVM Wikipedia
  2. A nice online book on the internals of JVM: Inside JVM by Bill Venners
  3. Java HotSpot VM Options
  4. IBM JVM Documentation
  5. OpenJDK Wiki
  6. Oracle HotSpot Wiki - Has information about JVM internals.

What questions should have this tag?

  1. Questions to know how a JVM works in a specific scenario
  2. Questions which deal with tools provided with a JVM
12159 questions
99
votes
5 answers

Does the JVM prevent tail call optimizations?

I saw this quote on the question: What is a good functional language on which to build a web service? Scala in particular doesn't support tail-call elimination except in self-recursive functions, which limits the kinds of composition you can do…
Jason Dagit
  • 13,684
  • 8
  • 33
  • 56
98
votes
9 answers

Java 32-bit vs 64-bit compatibility

Will Java code built and compiled against a 32-bit JDK into 32-bit byte code work in a 64-bit JVM? Or does a 64-bit JVM require 64-bit byte code? To give a little more detail, I have code that was working in a Solaris environment running a 32-bit…
mshafrir
  • 5,190
  • 12
  • 43
  • 56
98
votes
9 answers

Implementing C# for the JVM

Is anyone attempting to implement C# for the JVM? As a Java developer, I've been eyeing C# with envy, but am unwilling to give up the portability and maturity of the JVM, not to mention the diverse range of tools for it. I know there are some…
Rob
  • 5,512
  • 10
  • 41
  • 45
98
votes
5 answers

Why does the JVM still not support tail-call optimization?

Two years after does-the-jvm-prevent-tail-call-optimizations, there seems to be a prototype implementation and MLVM has listed the feature as "proto 80%" for some time now. Is there no active interest from Sun's/Oracle's side in supporting tail…
soc
  • 27,983
  • 20
  • 111
  • 215
98
votes
7 answers

Duplicated Java runtime options : what is the order of preference?

Considering the following command line java -Xms128m -Xms256m myapp.jar Which settings will apply for JVM Minimum memory (Xms option) : 128m or 256m ?
fabien7474
  • 16,300
  • 22
  • 96
  • 124
97
votes
4 answers

How do I start my Java program with more than one java agent?

I'm aware of how to start a java progam with a java agent: java -javaagent:myAgent.jar MyJavaProgram But what if I want to add 2 or more java agents to instrument my program? I do not want to reinvoke the java -javaagent:... for every agent I have…
Flueras Bogdan
  • 9,187
  • 8
  • 32
  • 30
97
votes
9 answers

How to hide warning "Illegal reflective access" in java 9 without JVM argument?

I just tried to run my server with Java 9 and got next warning: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil…
Dmitriy Dumanskiy
  • 11,657
  • 9
  • 37
  • 57
97
votes
7 answers

Increasing the JVM maximum heap size for memory intensive applications

I need to run a Java memory intensive application that uses more than 2GB, but I am having problems to increase the heap maximum size. So far, I have tried the following approaches: Setting the -Xmx parameter, e.g. -Xmx3000m. This approaches fails…
Alceu Costa
  • 9,733
  • 19
  • 65
  • 83
97
votes
7 answers

How to see JIT-compiled code in JVM?

Is there some way to see the native code produces by the JIT in a JVM?
alsor.net
  • 1,142
  • 1
  • 8
  • 9
95
votes
2 answers

When multiple java programs run on the same machine

Each java application will run in a specific Java Virtual Machine Instance. I am really getting confused on below aspects and Googling has confused me even more. Different articles on different sites. If I have a web service written in java it…
Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289
94
votes
4 answers

What are ReservedCodeCacheSize and InitialCodeCacheSize?

Can someone please explain what the JVM option ReservedCodeCacheSize and InitialCodeCacheSize are? Specifically when/why would I want to change it? How do I decide what the right size is? This is what the docs say: -XX:ReservedCodeCacheSize=32m …
Raghu
  • 2,004
  • 1
  • 16
  • 18
93
votes
1 answer

GC overhead limit exceeded

What is the sampling time JVM uses to throw 'java.lang.OutOfMemoryError : GC overhead limit exceeded'? I know you can control 98% and 2% with parameters GCTimeLimit and GCHeapFreeLimit but whats the sampling time?
PRK
  • 959
  • 1
  • 6
  • 3
92
votes
4 answers

How can I increase the JVM memory?

HI, I like to know can I increase the memory of the JVM depending on my application.If yes how can I increase the JVM memory? And how can I know the size of JVM?
giri
  • 26,773
  • 63
  • 143
  • 176
90
votes
31 answers

Android Studio - No JVM Installation found

I'm having issues trying to boot-up Android Studio When I try to launch it after installation I'm getting this error: No JVM Installation found. Please install a 64 bit JDK. My current system specification: Operating System: Windows 8.0 64 bit…
Qarib Haider
  • 4,796
  • 5
  • 27
  • 38
90
votes
4 answers

What is the loop inversion technique?

I was going through a document which talks about just-in-time compiler (JIT) optimization techniques for Java. One of them was "loop inversion". And the document says: You replace a regular while loop with a do-while loop. And the do-while loop…
Trying
  • 14,004
  • 9
  • 70
  • 110