is JVM can run other Programming languages ??? | Sololearn: Learn to code for FREE!

+1

is JVM can run other Programming languages ???

i have an doubts : JVM stand for java Virtual machine .. and it's created to convert java code into machine code ... my question is . can we run other Programming languages on JDK (JVM) ?🥱🤔

9/19/2021 10:43:45 AM

Saurya

9 Answers

New Answer

+6

zemiak, seems to be the only one who understands the Java Virtual Machine (JVM). The JVM does not run languages in the same way as any CPU does not understand higher level languages. CPUs only understand their native machine code and the JVM only understands Java byte code. It is the job of the compiler to convert the high level programming language into code that the CPU or JVM understands. If you want to write a PASCAL, FORTH, COBOL, C/C++, C# or whatever compiler that targets the Java Virtual Machine there is nothing to stop you from doing so. Jython is an implementation of the Python programming language designed to run on the Java platform. Mozilla Rhino and Oracle's Nashorn are JavaScript engine implementations written in Java. This does not mean that the JVM understands Python or JavaScript. Kotlin can target the JVM, JavaScript or native code.

+5

jvm just do execution no compiling or transpiling. It can run products of compilers of java, kotlin, scala, some version of python and ruby, ... https://en.m.wikipedia.org/wiki/List_of_JVM_languages

+2

Since Kotlin code is converted into bytecode they require jvm to run

+1

Niththish is JVM can convert other language code into byte code ?

+1

No. I think it won't and can't.

+1

Niththish what about Kotlin 🙄

+1

Niththish chalo koi na bhai mujhe hi jyada sochna padega lagta h 🧐🧐

+1

The key is the native language of the JVM: the Java bytecode. Any language can be compiled into bytecode which the JVM understands - all you need for this is a compiler emitting bytecode. From then on, there is no difference from the JVM's point of view. So much so that you can take a compiled Scala, Clojure, Jython etc. class file and decompile it (using e.g. JAD) into normal looking Java source code.

0

Yes you can JVM runs any files that are converted into java byte code So if you want to run other languages on jvm firstly you have to convert it into java byte code The .class file is know as the java byte code which you will be getting after compiling your code.