When you run a .exe
console application in Windows (such as one written in C++), Windows creates a console window for you.
So in essence, the program doesn't run on top of anything other than Windows itself.
When you invoke java Main.class
inside the cmd.exe console, is it really its own standalone program? It feels more like java
is the program running and Main.class
is just an argument given.
All of this is to ask, are all Java programs simply console java [argument]
programs? Another way to ask, are all Java programs just JRE programs/instances that are reading a particular class file?
You need a JRE but not the JDK. The JRE is the java runtime environment and java code cannot be executed without it. The . jar is a compiled java file can and this needs the java runtime environment to be run.
1. Java is a software platform, while JRE is a software package. 2. JRE contains the necessary software for running Java applications.
The Java Runtime Environment (JRE) is software that Java programs require to run correctly. Java is a computer language that powers many current web and mobile applications. The JRE is the underlying technology that communicates between the Java program and the operating system.
JVM is a part of JRE(Java Runtime Environment). Java applications are called WORA (Write Once Run Anywhere). This means a programmer can develop Java code on one system and can expect it to run on any other Java-enabled system without any adjustments. This is all possible because of JVM.
To put a simpler spin on this, the answer is: Yes (although you really mean the JVM rather than the JRE). The program that the OS is running is the JVM (Java virtual machine), and the Java application is data being read by that program. The JVM is like Microsoft Word, and Java programs are like Word documents.
This question is hitting upon the essential difference between compiled and interpreted languages, as described well here.
To use the analogy further to explain what the JVM and JRE are...The JVM is like the Microsoft Word program itself, and the JRE is like the MS Word program plus all the other stuff, like templates, sample documents, fonts, etc. that is installed along with it to support what it does.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With