What does "Run in the JVM" mean?

10

Languages like Scala, Kotlin, Clojure and others "run on the JVM".

  • What does this mean?

  • What does the JVM provide for them?

  • How much are "dependent" on the JVM?

  • Do they only run on the JVM?

  • Do these languages generate a .class equal to Java to run in the JVM?

asked by anonymous 08.08.2017 / 02:16

1 answer

11
  

What does this mean?

It means that they generate a JVM-compatible "binary" that it can understand, which follows all the protocols specified by this platform. It's like saying that an application is capable of running on Windows, or even on ARM.

  

What does the JVM provide for them?

A runtime environment that interprets bytecode , generates native code for the platform at a lower level ( JITter ), memory management (GC) and security, all infrastructure to interoperate with other applications and components external to the JVM, and also a large library although technically not part of the JVM, but something that is always along with it, forming the Java Runtime Environment (JRE). In short, it is a virtual machine simulating a processor and an operating system within a specific standard where applications can focus, letting this machine understand the actual platforms where they will run.

  

How much are "dependent" on the JVM?

The language itself should not be, but it is common that even language needs specific features of the platform that runs. In fact, it is not the JVM that is the problem, it is the library available to the platform that is usually adopted by the language that practically makes the language dependent on that platform. Not that it has no solution, but it becomes complicated to make it compatible on another platform.

  

Do they only run on the JVM?

Nothing prevents them from running wherever they please unless otherwise specified or something that only the JVM can provide, which is often unlikely.

  

Do these languages generate a .class equal to Java to run in the JVM?

Usually yes, but it is possible that some language creates an infrastructure that makes access different.

    
08.08.2017 / 02:31