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?
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.