This forum is deprecated.
You may not know this, but Java comes in many flavors and parts. After Oracle acquired Sun Microsystems, they became the official owner of the Java trademark and the main “official” Java distributions.
First off a disclaimer: I’m not a lawyer, nor am I a Java developer. This is a high-level overview of a number of complex issues related to Java, Java development, and licensing. My goal is to give you enough information to move forward and be successful, but I encourage you to do some additional research and consult a lawyer if you need additional information. I know that I will miss details and gloss over important points.
Java is made up of the following parts
Where it gets interesting is with the OpenJDK, a free and open-source implementation of the Java Standard Edition (SE) Platform. It is the official reference implementation of Java SE since version 7. The source implementation is licensed under the GNU General Public License version 2 with a linking exception. [wikipedia] Similar to how Chrome is based on the open-source Chromium project, Java SE is based on OpenJDK.
Anyone, yourself included, could download the OpenJDK source files and create a binary build. There are a number of organizations that do that, and each one has its own spin on licensing, support, and included components. Here are a few (these are binary distributions of the OpenJDK source).
AdoptOpenJDK / JClarity / IBM Java SDK
BellSoft Liberica JDK
Oracle Java SE
Red Hat OpenJDK
Red Hat for Windows
Oracle provides direct OpenJDK builds, but those builds directly from Oracle do not include long term support or commercial support. For that Oracle wants you to switch to Oracle SE, which does not have a permissive license (Oracle recently changed the licensing on their Standard Edition JDK to charge an annual fee for commercial use). So while OpenJDK source has a permissive license, the binary distribution from Oracle does not have the same license.
That is where AdoptOpenJDK (and others) come in. They take the open-source OpenJDK source files and provide a binary distribution with long term support (updates and fixes for old version), a permissive license, and commercial support. AdoptOpenJDK is maintained and backed by the community and a number of large companies including IBM, GoDaddy, Microsoft, and Red Hat.
RAD Studio doesn't directly depend on Java, but if you are using the Android SDK to target Android then you are using it. The current RAD Studio installer offers you the option to install the standard Oracle JDK if you don’t already have one installed. In the future (approximately 10.4.x timeframe), Embarcadero is planning to change the default option to install AdoptOpenJDK.
The decision for which JDK and JRE to use is up to you. In this blog post, I will walk you through switching to the AdoptOpenJDK with HotSpot JRE (HotSpot is the official JVM used by the Oracle JDK, but there are others you can choose from.)
If you already have Oracle’s JRE or JDK installed, you may want to uninstall it. Unless you have other software on your computer that depends on it specifically. If you only installed it for Android development with Delphi then you are fine to uninstall it. Because of the way it updates you may discover you have multiple versions installed.
Visit https://adoptopenjdk.net/ and if you are on a Windows computer it should default to the download you want. Yes, we want version 8 even though there are new versions. Version 8 is the most popular version for most use cases, including for Android development, and the different versions are not compatible.
If you are on a 32-bit version of Windows you really need to upgrade to a 64-bit platform. Go do that and come back when you are done. You do not need to install the 32-bit version on 64-bit Windows. If you happen to be visiting the website from a different computer though, you can go to the other platforms/releases page and find the download you need there. You need the full JDK (which includes the JRE), not just the JRE, for Windows x64.
During the installation, you will accept the GNU GENERAL PUBLIC LICENSE. This is only for the JDK and does not impact any projects you develop (again talk to a lawyer or read the licenses yourself to be sure.) I like to have the installer set the JAVA_HOME environment variable, but that is optional. Otherwise, you can go with the defaults.
Now it is just a matter up updating the settings in your Delphi / RAD Studio IDE. Go to Tools → Options → Deployment → SDK Manager and then select one of your Android SDK (32 or 64-bit) and jump to the Java tab, where you should see something like the image below.
If you left your Oracle Java SE JDK installed then you won’t have the yellow triangle because the old JDK is still there. Then use the ellipsis browse button to change it to the path you installed AdoptOpenJDK. Be sure to change all of your Android SDK entries.
From that point forward you shouldn't notice any changes. It just works. Both the Oracle SE JDK and AdoptOpenJDK are based on the same source code the functionality is the same.
My preferred way to install and update the AdoptOpenJDK is with the Chocolatey Windows package manager.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install adoptopenjdk8
choco update adoptopenjdk8
I'm a huge fan of the Chocolaty package manager (I have a Pro subscription). If you take a look at it I'm sure you will find it very useful.
Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder. Design. Code. Compile. Deploy.
Start Free Trial
Free Delphi Community Edition
Free C++Builder Community Edition
+1 for chocolatey :-)thanks for the article, there is a lot of confusion about java/jre/jdk lately.