Java starting 25-8-26¶
Here is the full summary of our discussion formatted as a question and answer session: Q: What is the JRE (Java Runtime Environment) and how does it relate to the JDK? A: The JRE is a subset of the JDK (Java Development Kit) that historically contained only the tools needed to run a Java application (the JVM and core libraries). It did not include compilation tools like javac. Today, Oracle and the OpenJDK team no longer distribute the JRE as a separate, standalone download. Instead, users download the JDK, or developers build custom runtimes directly into their applications. Q: How can I use javac and java together in a single command? A: Starting in Java 11, you can compile and run a single-file Java program in one step by passing the source file directly to the java command, like this: java HelloWorld.java. Q: Does the single-command feature create .class files on the disk in Java 22 or newer? A: No. Even in Java 22 and newer—which expanded this feature to automatically handle multi-file programs—no physical .class files are ever generated or saved to your disk. Q: If no files are created on the disk, where is the compiled bytecode stored? A: The bytecode is stored purely in the computer's volatile memory (RAM). The Java launcher compiles the source code into an in-memory byte array, and the JVM loads it using a custom internal class loader. The moment the program exits and the JVM shuts down, that memory is cleared and the bytecode disappears.