Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are Java programs just instances of the JRE?

Tags:

java

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?

like image 507
katie1245 Avatar asked Oct 28 '20 02:10

katie1245


People also ask

Is Java program required for JRE?

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.

Is Java the same as JRE?

1. Java is a software platform, while JRE is a software package. 2. JRE contains the necessary software for running Java applications.

Is JRE the runtime portion of Java software?

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.

Is the JVM part of the JRE?

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.


1 Answers

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.

like image 109
CryptoFool Avatar answered Oct 14 '22 10:10

CryptoFool