javaoperating-systemjava-runtime-compiler

Do all operating systems already have JRE installed for running java applications?


Let say I am not a java developer and an ordinary person, and installing any application that is written in Java. So, do I need to first install the JRE or no all operating systems already have JRE installed on them?


Solution

  • Do all operating systems already have JRE installed for running java applications?

    No.

    First of all, Java is not necessarily available for all operating systems. (It is probably available for most operating systems that are targeted by your application ... but it might not be.)

    Secondly, most operating system platforms don't have Java installed by default. Indeed many OS vendors don't support Java at all: Java is provided by a 3rd-party vendor.

    So, do I need to first install the JRE or no all operating systems already have JRE installed on them?

    Prior to Java 9, the answer is that you have to install a JRE or a JDK. This can be done by downloading and installing it directly, or installing it via a package management system on some OSes. It can also be done by embedding a JRE in your application's installer.

    From Java 9 onwards, you can also use "jlink" to create an executable that contains a cut-down JRE which is tailored to run your application on a specific target platform. This is the approach recommended by Oracle for people who want to distribute "consumer grade" Java applications.

    And from Java 11 onwards, for some Java vendors (Oracle for example), the JRE option is no longer available. For these vendors, if you want "full" Java to run your application, you / your users need to install a JDK.