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
302
votes
3 answers

What does -XX:MaxPermSize do?

Specifically, why would it help to fix a PermGen OutOfMemoryError issue? Also, bonus points for an answer that points me to the documentation on JVM arguments...
Zefira
  • 4,329
  • 3
  • 25
  • 31
296
votes
25 answers

How can I get a random number in Kotlin?

A generic method that can return a random integer between 2 parameters like ruby does with rand(0..n). Any suggestion?
Yago Azedias
  • 4,480
  • 3
  • 17
  • 31
280
votes
12 answers

Class JavaLaunchHelper is implemented in both ... libinstrument.dylib. One of the two will be used. Which one is undefined

I upgraded to the latest Java 7u40 on MacOS X and started getting the following message on the console when launching my application using Eclipse. The app works fine but I would like to find out the cause of the problem and hopefully a fix for it.…
ams
  • 60,316
  • 68
  • 200
  • 288
276
votes
5 answers

JVM option -Xss - What does it do exactly?

It says here that -Xss is used to "set thread stack size", what does it mean exactly? Could anyone help me understand this?
instantsetsuna
  • 9,183
  • 8
  • 25
  • 28
271
votes
13 answers

Get a list of all threads currently running in Java

Is there any way I can get a list of all running threads in the current JVM (including the threads not started by my class)? Is it also possible to get the Thread and Class objects of all threads in the list? I want to be able to do this through…
Kryten
  • 3,843
  • 5
  • 37
  • 42
267
votes
20 answers

How to get a thread and heap dump of a Java process on Windows that's not running in a console

I have a Java application that I run from a console which in turn executes an another Java process. I want to get a thread/heap dump of that child process. On Unix, I could do a kill -3 but on Windows AFAIK the only way to get a thread dump is…
macgreg
255
votes
13 answers

How do I run a Java program from the command line on Windows?

I'm trying to execute a Java program from the command line in Windows. Here is my code: import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import…
Elizabeth Turner
  • 2,711
  • 3
  • 15
  • 11
254
votes
12 answers

How to activate JMX on my JVM for access with jconsole?

How to activate JMX on a JVM for access with jconsole?
Mauli
  • 16,863
  • 27
  • 87
  • 114
252
votes
10 answers

In which language are the Java compiler and JVM written?

In which languages are the Java compiler (javac), the virtual machine (JVM) and the java starter written?
Rahul Garg
  • 8,410
  • 8
  • 33
  • 28
250
votes
14 answers

Java "Virtual Machine" vs. Python "Interpreter" parlance?

It seems rare to read of a Python "virtual machine" while in Java "virtual machine" is used all the time. Both interpret byte codes; why call one a virtual machine and the other an interpreter?
twils
  • 2,664
  • 3
  • 18
  • 7
243
votes
6 answers

PermGen elimination in JDK 8

I have installed JDK 8 and trying to run Eclipse. I am getting following warning message: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0 What are the reasons for ignoring this VM option?
Shamim Ahmmed
  • 8,265
  • 6
  • 25
  • 36
241
votes
3 answers

Difference between _JAVA_OPTIONS, JAVA_TOOL_OPTIONS and JAVA_OPTS

I thought it would be great to have a comparison between _JAVA_OPTIONS and JAVA_TOOL_OPTIONS. I have been searching a bit for one, but I cannot find anything, so I hope we can find the knowledge here on Stackoverflow. JAVA_OPTS is included for…
Tobber
  • 7,211
  • 8
  • 33
  • 56
236
votes
10 answers

What actually causes a Stack Overflow error?

I've looked everywhere and can't find a solid answer. According to the documentation, Java throws a java.lang.StackOverflowError error under the following circumstance: Thrown when a stack overflow occurs because an application recurses too…
retrohacker
  • 3,194
  • 4
  • 21
  • 31
217
votes
43 answers

Eclipse error: 'Failed to create the Java Virtual Machine'

I am getting this error message when I start Eclipse Helios on Windows 7: Failed to create the Java Virtual Machine My eclipse.ini looks as…
Maro
  • 4,065
  • 7
  • 33
  • 34
195
votes
5 answers

Java using much more memory than heap size (or size correctly Docker memory limit)

For my application, the memory used by the Java process is much more than the heap size. The system where the containers are running starts to have memory problem because the container is taking much more memory than the heap size. The heap size is…
Nicolas Henneaux
  • 11,507
  • 11
  • 57
  • 82