After releasing the module feature in Java and creating custom JRE, my question is what’s really happen theoretically with custom JRE?
I know JRE (Java Runtime Environment) have inside JVM (Java Virtual Machine) and libraries that can run Java bytecode for environment (OS and CPU). So, if we use a Java custom JRE, what actually happens internally in guest PC and where is the JVM?
In Java 8 we download JRE and users can use our app, but after module feature the official JRE from Oracle is not released and the developer has to use custom JRE. So how could developer guess the OS or CPU architecture types (to send (Add) right JRE)? I don’t use this feature right now, and I’m researching about it.
My question focused on what happened after compile code to java bytecode and send it for the user that have not jre and if my application can’t start without jre and I need to use custom jre how can I know which type of machine running my code ? because in official jre the user download and use the java application but now the developer need to send custom jre that maybe not good for all users.
I think if knowing what happened here with custom jre(understanding the workflow) that can help me to use it.
The @StephenC answer is helpful and I need more details.
I’m (still) not sure that I understand what you are really asking. However, I will answer based on what I think you are asking.
I know a JRE has inside a JVM and libraries that can run Java bytecodes for environment (OS and CPU).
That is sort of correct, but not exactly.
The JVM is actually running thing. You get it when you run the
java command. It isn’t the
java command itself.
Thus we can’t literally say that the JVM is “inside” the JRE. It is a running process on the hardware.
So if we use java custom JRE What actually happened internal in guest PC and where it’s the JVM?
It is essentially the same. The custom JRE includes a launcher (executable) that runs your application. When you run that launcher, you get a JVM running your Java application.
I Java 8 we can download a JRE and users can use it to run our apps.
but after module feature the Official JRE from oracle not released and the developer have to use custom JRE.
You are conflating two things here:
It is true that Oracle (and OpenJDK) doesn’t provide a (regular) JRE downloadable from Java 9 onwards. However:
- There is nothing to stop you … or your user from using a JDK distro instead.
- There are other Java suppliers / vendors that continue to provide a JRE distro in one form or another.
You can create a custom JRE using the
… so how could developer guess the OS or CPU Architecture types.
If you are going to use
jlink to create a custom JRE, you need to do it for each OS & CPU architecture that you support.
But as noted, you can still instruct the user to install a conventional JRE or JDK and continue to use ship your application as a JAR file, or a installer, or …