How does JVM, Java, JDK and JRE work?

Asked

Viewed 167 times

0

Java can compile to .exe?

Does every operating system, such as Windows, Macos, Linux, etc. already come with JVM installed to interpret the program made in Java? Or when compiling the program b.exe already comes with the built-in JVM?

Because to use a Java program you need JRE, and to develop it you need a JDK?

1 answer

6

Java can compile to .exe?

Java is a programming language so it doesn’t define that kind of thing. A implementation language specific can generate a .exe and in fact some do, but not the most common one that people use.

And generate a .exe only makes sense even in Windows, right? It’s a little more complicated than that, but to simplify it would be like this.

If you want to know if the compiler generates a binary file that is capable of being executed in any way, then yes, the .class is this file (also has the .jar). The extension does not define whether it can be executed, defines, conform to the content within a specific binary format that some operating systems understand.

If you want to know if it generates a native binary that runs directly on the processor, then this .class It’s not like that, he’s a bytecode that will be Jittado.

There is an implementation that has an intermediate binary, similar to .class, but a little different and when it is installed a native binary is generated for the operating system to run directly.

You can see more in What is the difference between compiled language for interpreted?.

I think it’s a little outdated: Programming language that does not require prior installation (at the time all implementations run in a similar way and required an installed environment).

Does every operating system, such as Windows, Macos, Linux, etc. already come with JVM installed to interpret the program made in Java? Or when compiling the program b.exe already comes with the built-in JVM?

Operating systems do not usually come with JRE installed (Android is an exception, but it is not the standard JRE that is in it, it has ART). For the most common form of Java you need to install it before you use it. But as was said before has implementation that the Runtime can be next to your application, there you do not need to install anything before.

Java is not interpreted.

Because to use a Java program you need JRE, and to develop it you need a JDK?

JDK is the Java SDK, you can see in What is an SDK?. JRE (Java Runtime Environment) is the installed environment where you have Runtime and what you need for the application to run.

Maybe this will help: What it means "Run on JVM"?.

Despite being . NET helps explain what is the Runtime, the details are different, but the idea is the same: What is really the "Runtime Environment"?

It may seem confusing and an answer can help: After all, Java is a platform or programming language?.

Might be of interest: Relationship between Hotspot and JVM, JDK/Openjdk? and What is the Graalvm?.

  • Very well I understood everything thank you

  • @Gutobritodosantos see in the [tour] the best way to say thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.