Java SE TutorialsFree and quality Java programming tutorials, articles, guides, code examples, sample projects and best practiceshttps://www.codejava.net/java-se2024-05-06T23:33:10-05:00Joomla! - Open Source Content ManagementJava SE versions history2012-03-10T08:18:14-06:002012-03-10T08:18:14-06:00https://www.codejava.net/java-se/java-se-versions-historyNam Ha Minhhainatu@gmail.com<div class="feed-description"><p>This article gives you an overview of all Java versions throughout its history, for Java Standard Edition (SE) Development Kit (JDK), from the first version to the latest one till date.</p> <p><strong>The latest version of Java is Java 22 or JDK 22</strong>&nbsp;released on March, 19th 2024 (follow <a href="java-core/how-to-check-java-version" target="_blank">this article</a> to check Java version on your computer). <strong>JDK 22</strong> is a regular update of Java SE platform. And <strong>JDK 21</strong> is currently the latest long-term support release (LTS), replacing JDK 17 which is the previous LTS of the Java SE platform.</p> <p>From the first version released in 1996 to the latest version JDK 22 available to the public since March 2024, the Java platform has been actively being developed for more than 28 years. Many changes and improvements have been made to the technology over the years. The following table summarizes all versions of Java SE from its early days to the latest.</p> <div align="center"> <table style="border-collapse: collapse;" border="1" cellspacing="10" cellpadding="10"> <tbody> <tr> <td style="width: 90.9pt; border: 1pt solid windowtext; background: none repeat scroll 0% 0% #002060; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;"><strong><span style="color: white;">Java SE Version&nbsp;</span></strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; background: none repeat scroll 0% 0% #002060; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;"><strong><span style="color: white;">Version Number</span></strong></span></p> </td> <td style="border: 1pt solid windowtext; background: none repeat scroll 0% 0% #002060; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;"><strong><span style="color: white;">Release Date</span></strong></span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong>JDK 1.0</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">(Oak)</p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.0</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">January 1996</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong>JDK 1.1</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.1</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">February 1997</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong>J2SE 1.2</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt; font-family: verdana, geneva;"><span style="color: #000000; font-size: 13.3333px;">(Playground)</span></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.2</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">December 1998</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong>J2SE 1.3</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">(Kestrel)</span></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.3</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">May 2000</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong>J2SE 1.4</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">(Merlin)</span></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.4</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">February 2002</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong>J2SE 5.0</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">(Tiger)</span></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.5</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">September 2004</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">Java SE&nbsp;</strong>6</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">(Mustang)</span></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.6</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">December 2006</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">Java SE&nbsp;</strong>7</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">(Dolphin)</span></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.7</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">July 2011</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">Java SE&nbsp;</strong>8</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.8<i>&nbsp;</i></span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">March 2014</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">Java SE&nbsp;</strong>9</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">9<i>&nbsp;</i></span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">September, 21st 2017</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">Java SE&nbsp;</strong>10</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">10&nbsp;</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">March, 20th 2018</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong style="background-color: transparent;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">Java SE&nbsp;</strong>11</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">11&nbsp;</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="background-color: transparent; font-size: 10pt;">September, 25th 2018</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; background-color: transparent;">Java SE 12</strong></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">12</span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">March, 19th 2019</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; background-color: transparent;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: transparent; font-size: 16px;">Java SE 13</strong></strong></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"> <p><span style="font-size: 12pt;"><span style="background-color: transparent;"><span>13</span></span></span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">September, 17th 2019</span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: transparent; font-size: 16px;">Java SE 14</strong></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"> <p><span style="background-color: transparent; font-size: 12pt;">14&nbsp;</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">March, 17th 2020</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: transparent; font-size: 16px;">Java SE 15</strong></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"> <p><span style="background-color: transparent; font-size: 12pt;">15</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">September, 15th 2020</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><strong><span style="font-size: 12pt;">Java SE 16</span></strong></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"> <p><span style="background-color: transparent; font-size: 12pt;">16</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">March, 16th 2021</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"><span style="font-size: 12pt;">Java SE 17</span></strong></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"> <p><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">17</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">September, 14th 2021</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong><span style="font-size: 12pt;">Java SE 18</span></strong></p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong><span style="font-size: 12pt;">&nbsp;</span></strong></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">18</span> <p>&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">March, 22nd 2022</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;<strong><span style="font-size: 12pt;">Java SE 19</span></strong><strong style="background-color: transparent;"><span style="font-size: 12pt;">&nbsp;</span></strong>&nbsp;</p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">19</span><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;"></span></td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p>&nbsp;</p> <p><span style="font-size: 10pt;">September, 20th 2022</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"><span style="font-size: 12pt;">Java SE 20</span></strong></p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">20</span></td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p>&nbsp;</p> <p><span style="font-size: 13.3333px; background-color: transparent;">March, 21st 2023</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"><span style="font-size: 12pt;">Java SE 21 (LTS)</span></strong></p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">21</span></td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p>&nbsp;</p> <p><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">September, 19th 2023</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"><span style="font-size: 12pt;"></span></strong></p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"><span style="font-size: 12pt;">Java SE 22</span></strong></p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"><span style="font-size: 12pt;"></span></strong></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">22</span></td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p>&nbsp;</p> <p><span style="font-size: 13.3333px; background-color: transparent;">March, 19th 2024</span></p> </td> </tr> </tbody> </table> </div> <p>&nbsp;</p> <p>From the table above we can see that the naming and the version number have been changing over times:</p> <ul> <li>Versions 1.0 and 1.1 are named as JDK (Java Development Kit).</li> <li>From versions 1.2 to 1.4, the platform is named as J2SE (Java 2 Standard Edition).</li> <li>From versions 1.5, Sun introduces internal and external versions. Internal version is continuous from previous ones (1.5 after 1.4), but the external version has a big jump (5.0 for 1.5). This could make confusion for someone, so keep in mind that version 1.5 and version 5.0 are just two different version names for only one thing.</li> <li>From Java 6, the version name is Java SE X.</li> </ul> <p>Major versions were released after every 2 years, however the Java SE 7 took 5 years to be available after its predecessor Java SE 6, and 3 years for Java SE 8 to be available to public afterward.</p> <p>Since Java SE 10,&nbsp; new versions will be released very six months.</p> <p>&nbsp;</p> <h3>Related Topics:</h3> <ul> <li><a href="java-core/what-is-java" target="_blank">What is Java?</a></li> <li><a href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a href="java-core/features-of-the-java-programming-language" target="_blank">Understand 9 features of Java programming language</a></li> <li><a href="java-core/how-to-write-compile-and-run-a-hello-world-java-program-for-beginners" target="_blank">How to write, compile and run a hello world Java program for beginners</a></li> </ul> <p>&nbsp;</p> <p>If you want to dive deep into Java programming and become a software developer, I recommend you to learn <a href="https://click.linksynergy.com/link?id=d1Fh24*EiQI&amp;offerid=323058.533682&amp;type=2&amp;murl=https%3A%2F%2Fwww.udemy.com%2Fjava-the-complete-java-developer-course%2F&amp;u1=WebFooter" rel="nofollow" target="_blank">this Java course</a> on Udemy.</p></div><div class="feed-description"><p>This article gives you an overview of all Java versions throughout its history, for Java Standard Edition (SE) Development Kit (JDK), from the first version to the latest one till date.</p> <p><strong>The latest version of Java is Java 22 or JDK 22</strong>&nbsp;released on March, 19th 2024 (follow <a href="java-core/how-to-check-java-version" target="_blank">this article</a> to check Java version on your computer). <strong>JDK 22</strong> is a regular update of Java SE platform. And <strong>JDK 21</strong> is currently the latest long-term support release (LTS), replacing JDK 17 which is the previous LTS of the Java SE platform.</p> <p>From the first version released in 1996 to the latest version JDK 22 available to the public since March 2024, the Java platform has been actively being developed for more than 28 years. Many changes and improvements have been made to the technology over the years. The following table summarizes all versions of Java SE from its early days to the latest.</p> <div align="center"> <table style="border-collapse: collapse;" border="1" cellspacing="10" cellpadding="10"> <tbody> <tr> <td style="width: 90.9pt; border: 1pt solid windowtext; background: none repeat scroll 0% 0% #002060; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;"><strong><span style="color: white;">Java SE Version&nbsp;</span></strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; background: none repeat scroll 0% 0% #002060; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;"><strong><span style="color: white;">Version Number</span></strong></span></p> </td> <td style="border: 1pt solid windowtext; background: none repeat scroll 0% 0% #002060; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;"><strong><span style="color: white;">Release Date</span></strong></span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong>JDK 1.0</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">(Oak)</p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.0</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">January 1996</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong>JDK 1.1</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.1</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">February 1997</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong>J2SE 1.2</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt; font-family: verdana, geneva;"><span style="color: #000000; font-size: 13.3333px;">(Playground)</span></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.2</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">December 1998</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong>J2SE 1.3</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">(Kestrel)</span></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.3</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">May 2000</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong>J2SE 1.4</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">(Merlin)</span></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.4</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">February 2002</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong>J2SE 5.0</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">(Tiger)</span></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.5</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">September 2004</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">Java SE&nbsp;</strong>6</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">(Mustang)</span></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.6</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">December 2006</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">Java SE&nbsp;</strong>7</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">(Dolphin)</span></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.7</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">July 2011</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">Java SE&nbsp;</strong>8</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">1.8<i>&nbsp;</i></span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">March 2014</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">Java SE&nbsp;</strong>9</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">9<i>&nbsp;</i></span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">September, 21st 2017</span></p> </td> </tr> <tr> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">Java SE&nbsp;</strong>10</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">10&nbsp;</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">March, 20th 2018</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;"><strong style="background-color: transparent;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">Java SE&nbsp;</strong>11</strong></span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">11&nbsp;</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="background-color: transparent; font-size: 10pt;">September, 25th 2018</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; background-color: transparent;">Java SE 12</strong></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="120"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 12pt;">12</span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">March, 19th 2019</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; background-color: transparent;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: transparent; font-size: 16px;">Java SE 13</strong></strong></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"> <p><span style="font-size: 12pt;"><span style="background-color: transparent;"><span>13</span></span></span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">September, 17th 2019</span></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: transparent; font-size: 16px;">Java SE 14</strong></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"> <p><span style="background-color: transparent; font-size: 12pt;">14&nbsp;</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">March, 17th 2020</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: transparent; font-size: 16px;">Java SE 15</strong></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"> <p><span style="background-color: transparent; font-size: 12pt;">15</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">September, 15th 2020</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><strong><span style="font-size: 12pt;">Java SE 16</span></strong></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"> <p><span style="background-color: transparent; font-size: 12pt;">16</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="font-size: 10pt;">March, 16th 2021</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"><span style="font-size: 12pt;">Java SE 17</span></strong></p> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"> <p><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">17</span></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">September, 14th 2021</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong><span style="font-size: 12pt;">Java SE 18</span></strong></p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong><span style="font-size: 12pt;">&nbsp;</span></strong></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">18</span> <p>&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p style="margin-bottom: 0.0001pt; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; line-height: normal;"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">March, 22nd 2022</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;<strong><span style="font-size: 12pt;">Java SE 19</span></strong><strong style="background-color: transparent;"><span style="font-size: 12pt;">&nbsp;</span></strong>&nbsp;</p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">19</span><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;"></span></td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p>&nbsp;</p> <p><span style="font-size: 10pt;">September, 20th 2022</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"><span style="font-size: 12pt;">Java SE 20</span></strong></p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">20</span></td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p>&nbsp;</p> <p><span style="font-size: 13.3333px; background-color: transparent;">March, 21st 2023</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"><span style="font-size: 12pt;">Java SE 21 (LTS)</span></strong></p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;">&nbsp;</p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">21</span></td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p>&nbsp;</p> <p><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px;">September, 19th 2023</span></p> </td> </tr> <tr style="height: 30px;" valign="top"> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="121"> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"><span style="font-size: 12pt;"></span></strong></p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"><span style="font-size: 12pt;">Java SE 22</span></strong></p> <p style="margin-bottom: 0.0001pt; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal;"><strong style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"><span style="font-size: 12pt;"></span></strong></p> </td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 120px;" valign="middle"><span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px;">22</span></td> <td style="border: 1pt solid windowtext; padding: 0in 5.4pt;" valign="top" width="186"> <p>&nbsp;</p> <p><span style="font-size: 13.3333px; background-color: transparent;">March, 19th 2024</span></p> </td> </tr> </tbody> </table> </div> <p>&nbsp;</p> <p>From the table above we can see that the naming and the version number have been changing over times:</p> <ul> <li>Versions 1.0 and 1.1 are named as JDK (Java Development Kit).</li> <li>From versions 1.2 to 1.4, the platform is named as J2SE (Java 2 Standard Edition).</li> <li>From versions 1.5, Sun introduces internal and external versions. Internal version is continuous from previous ones (1.5 after 1.4), but the external version has a big jump (5.0 for 1.5). This could make confusion for someone, so keep in mind that version 1.5 and version 5.0 are just two different version names for only one thing.</li> <li>From Java 6, the version name is Java SE X.</li> </ul> <p>Major versions were released after every 2 years, however the Java SE 7 took 5 years to be available after its predecessor Java SE 6, and 3 years for Java SE 8 to be available to public afterward.</p> <p>Since Java SE 10,&nbsp; new versions will be released very six months.</p> <p>&nbsp;</p> <h3>Related Topics:</h3> <ul> <li><a href="java-core/what-is-java" target="_blank">What is Java?</a></li> <li><a href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a href="java-core/features-of-the-java-programming-language" target="_blank">Understand 9 features of Java programming language</a></li> <li><a href="java-core/how-to-write-compile-and-run-a-hello-world-java-program-for-beginners" target="_blank">How to write, compile and run a hello world Java program for beginners</a></li> </ul> <p>&nbsp;</p> <p>If you want to dive deep into Java programming and become a software developer, I recommend you to learn <a href="https://click.linksynergy.com/link?id=d1Fh24*EiQI&amp;offerid=323058.533682&amp;type=2&amp;murl=https%3A%2F%2Fwww.udemy.com%2Fjava-the-complete-java-developer-course%2F&amp;u1=WebFooter" rel="nofollow" target="_blank">this Java course</a> on Udemy.</p></div>Download and Install Java 11 (OpenJDK and Oracle JDK)2020-04-30T07:00:19-05:002020-04-30T07:00:19-05:00https://www.codejava.net/java-se/download-and-install-java-11-openjdk-and-oracle-jdkNam Ha Minhhainatu@gmail.com<div class="feed-description"><p>In this post, I will guide you to setup Java 11 on Windows operating system by downloading and installing Java Development Kit (JDK) version 11 from Oracle. You know, Oracle released Java 11 builds under two different licenses: Oracle JDK (commercial build with Oracle Technology Network license) and OpenJDK (open source build with GNU General Public license).</p> <p>&nbsp;</p> <h2>1. Download and Install Oracle JDK 11</h2> <p>Oracle JDK 11 is the first LTS (Long Term Support) Java Development Kit since Oracle changed Java release cadence to every 6 months. According to Oracle, JDK 11 will be supported (commercial support) until September 2026.</p> <p>Head to <a href="https://www.oracle.com/java/technologies/javase-jdk11-downloads.html" rel="nofollow" target="_blank">Java SE Development Kit 11 Downloads</a> page and choose the download file appropriate to your operating system. Oracle JDK 11 comes with installers for Linux (rpm and deb), macOS (dmg), Windows (exe) and archive files (tar.gz and zip).</p> <p>For Windows, I recommend to download the file <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jdk-11.0.7_windows-x64_bin.exe</span>. Note that you must have an Oracle account to be able to download JDK 11 installer. If not, creating one is free.</p> <p>Run the downloaded file, and you will see the JDK 11 setup program appears:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-11/jdk_11_setup.png" alt="jdk 11 setup" /></p> <p>Just click Next twice to proceed installation with the defaults.</p> <p>Note that Oracle JDK 11 does not update system environment variables, so you have to manually update <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">PATH</span> and/or <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> after installation. Open Command Prompt window under administrator privilege and type the following command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">setx -m JAVA_HOME "C:\Program Files\Java\jdk-11.0.7" </span></p> <p>If the PATH environment variable does not contain an entry to <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME\bin</span>, type the following command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">setx -m PATH "%JAVA_HOME%\bin;%PATH%" </span></p> <p>Then open another command prompt window and type <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span>, you will see:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-11/java_11_version.png" alt="java 11 version" /></p> <p>That means you have successfully installed and configured Oracle JDK 11 on your computer.</p> <p>You can also watch the video below:</p> <p>https://www.youtube.com/watch?v=Wonb1ncRxbc</p> <p>&nbsp;</p> <h2>2. Download and Install OpenJDK 11</h2> <p>OpenJDK 11 is the open source distribution of JDK 11, licensed under GNU General Public License version 2 (GPLv2).</p> <p>To download OpenJDK 11, you have to go to <a href="http://jdk.java.net/archive/" rel="nofollow" target="_blank">OpenJDK Archive download</a> page. Then scroll down a little bit to find the version 11.0.2. OpenJDK is distributed in only zip or tar.gz file. For Windows, download the zip file for Windows 64-bit, i.e. <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">openjdk-11.0.2_windows-x64_bin.zip</span> file.</p> <p>Extract the downloaded zip file to a directory. Then type the following command to update <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> (in Command Prompt with administrator right):</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">setx -m JAVA_HOME "g:\JDK\OpenJDK\jdk-11.0.2"</span></p> <p>Then open another command prompt and type <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span>, you will see:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-11/open_jdk_version.png" alt="open jdk version" /></p> <p>That means you have successfully setup OpenJDK 11 on your computer.</p> <p>You can also watch the video below:</p> <p>https://www.youtube.com/watch?v=p_ielKr3k7U</p> <p>&nbsp;</p> <h3 style="font-family: 'Open Sans', sans-serif; color: #333333;">Related Tutorials:</h3> <ul style="font-size: 14.3px;"> <li><a style="cursor: pointer;" href="java-se/download-and-install-jdk-14-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 14</a></li> <li><a style="cursor: pointer;" href="java-se/download-and-install-jdk-13-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 13</a></li> <li><a href="java-se/download-and-install-jdk-12" target="_blank">Download and Install JDK 12</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a style="cursor: pointer;" href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div><div class="feed-description"><p>In this post, I will guide you to setup Java 11 on Windows operating system by downloading and installing Java Development Kit (JDK) version 11 from Oracle. You know, Oracle released Java 11 builds under two different licenses: Oracle JDK (commercial build with Oracle Technology Network license) and OpenJDK (open source build with GNU General Public license).</p> <p>&nbsp;</p> <h2>1. Download and Install Oracle JDK 11</h2> <p>Oracle JDK 11 is the first LTS (Long Term Support) Java Development Kit since Oracle changed Java release cadence to every 6 months. According to Oracle, JDK 11 will be supported (commercial support) until September 2026.</p> <p>Head to <a href="https://www.oracle.com/java/technologies/javase-jdk11-downloads.html" rel="nofollow" target="_blank">Java SE Development Kit 11 Downloads</a> page and choose the download file appropriate to your operating system. Oracle JDK 11 comes with installers for Linux (rpm and deb), macOS (dmg), Windows (exe) and archive files (tar.gz and zip).</p> <p>For Windows, I recommend to download the file <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jdk-11.0.7_windows-x64_bin.exe</span>. Note that you must have an Oracle account to be able to download JDK 11 installer. If not, creating one is free.</p> <p>Run the downloaded file, and you will see the JDK 11 setup program appears:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-11/jdk_11_setup.png" alt="jdk 11 setup" /></p> <p>Just click Next twice to proceed installation with the defaults.</p> <p>Note that Oracle JDK 11 does not update system environment variables, so you have to manually update <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">PATH</span> and/or <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> after installation. Open Command Prompt window under administrator privilege and type the following command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">setx -m JAVA_HOME "C:\Program Files\Java\jdk-11.0.7" </span></p> <p>If the PATH environment variable does not contain an entry to <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME\bin</span>, type the following command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">setx -m PATH "%JAVA_HOME%\bin;%PATH%" </span></p> <p>Then open another command prompt window and type <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span>, you will see:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-11/java_11_version.png" alt="java 11 version" /></p> <p>That means you have successfully installed and configured Oracle JDK 11 on your computer.</p> <p>You can also watch the video below:</p> <p>https://www.youtube.com/watch?v=Wonb1ncRxbc</p> <p>&nbsp;</p> <h2>2. Download and Install OpenJDK 11</h2> <p>OpenJDK 11 is the open source distribution of JDK 11, licensed under GNU General Public License version 2 (GPLv2).</p> <p>To download OpenJDK 11, you have to go to <a href="http://jdk.java.net/archive/" rel="nofollow" target="_blank">OpenJDK Archive download</a> page. Then scroll down a little bit to find the version 11.0.2. OpenJDK is distributed in only zip or tar.gz file. For Windows, download the zip file for Windows 64-bit, i.e. <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">openjdk-11.0.2_windows-x64_bin.zip</span> file.</p> <p>Extract the downloaded zip file to a directory. Then type the following command to update <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> (in Command Prompt with administrator right):</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">setx -m JAVA_HOME "g:\JDK\OpenJDK\jdk-11.0.2"</span></p> <p>Then open another command prompt and type <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span>, you will see:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-11/open_jdk_version.png" alt="open jdk version" /></p> <p>That means you have successfully setup OpenJDK 11 on your computer.</p> <p>You can also watch the video below:</p> <p>https://www.youtube.com/watch?v=p_ielKr3k7U</p> <p>&nbsp;</p> <h3 style="font-family: 'Open Sans', sans-serif; color: #333333;">Related Tutorials:</h3> <ul style="font-size: 14.3px;"> <li><a style="cursor: pointer;" href="java-se/download-and-install-jdk-14-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 14</a></li> <li><a style="cursor: pointer;" href="java-se/download-and-install-jdk-13-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 13</a></li> <li><a href="java-se/download-and-install-jdk-12" target="_blank">Download and Install JDK 12</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a style="cursor: pointer;" href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div>Download and Install JDK 14 (OpenJDK and Oracle JDK)2020-03-20T01:50:12-05:002020-03-20T01:50:12-05:00https://www.codejava.net/java-se/download-and-install-jdk-14-openjdk-and-oracle-jdkNam Ha Minhhainatu@gmail.com<div class="feed-description"><p>This article is a guide to download and install OpenJDK and Oracle JDK for <a href="java-se/java-14-new-features" target="_blank">Java 14</a> on Windows operating system.</p> <p>You know, Java Development Kit (JDK) 14 was released on March, 17<sup>th</sup> 2020 with two kinds of build: OpenJDK and Oracle JDK. OpenJDK is distributed under GPL license and Oracle JDK is distributed under Oracle Technology Network (OTN) license.</p> <p>&nbsp;</p> <h2>1. Download and Install OpenJDK 14</h2> <p>OpenJDK is a production-ready and open-source Java Development Kit, released under the GNU General Public License (GPL) version 2. That means you can freely use OpenJDK for personal, development and commercial use.</p> <p>Go to the official download page of OpenJDK 14: <a href="https://jdk.java.net/14/" rel="nofollow" target="_blank">https://jdk.java.net/14/</a></p> <p>Then choose the appropriate package for your operating system (Linux, MacOS or Windows). Note that OpenJDK comes with only archive file (zip or tar.gz), no installer program. For instance, the archive file for Windows is <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">openjdk-14_windows-x64_bin.zip</span> (~189MB).</p> <p>I strongly recommend you to verify the SHA256 checksum of the file downloaded. On Windows, type the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil</span> command like this:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil -hashfile openjdk-11.0.2_windows-x64_bin.zip SHA256</span></p> <p>Then compare the hash code generated with the one provided on the website. If both are identical, it’s safe to install and use.</p> <p>Then extract the archive file and update the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">PATH</span> or <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME</span> system environment variable pointing to the installation directory of JDK 14 (<a href="java-core/how-to-set-java-home-environment-variable-on-windows-10" target="_blank">Read the instruction here</a>). For example:</p> <p style="margin-left: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME=g:\JDK\OpenJDK\jdk-14</span></p> <p style="margin-left: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">PATH=%JAVA_HOME%\bin;…</span></p> <p style="margin-left: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">PATH= g:\JDK\OpenJDK\jdk-14\bin;…</span></p> <p>Then type the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span> command to verify. You should see the following screen:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-14/openjdk_java_version.png" alt="openjdk java version" /></p> <p>&nbsp;</p> <p>This means OpenJDK has been installed successfully.</p> <p>Watch the video:</p> <p>https://www.youtube.com/watch?v=TjNuyFOPPZE</p> <p>&nbsp;</p> <h2>2. Download and Install Oracle JDK 14</h2> <p>Oracle JDK is a commercial build for Java Development Kit. Oracle JDK is free for personal and development use, but you have to pay license fee for commercial use via Java SE subscription program.</p> <p>Click <a href="https://www.oracle.com/java/technologies/javase-jdk14-downloads.html" rel="nofollow" target="_blank">official Java SE download page</a> to download Oracle JDK which is distributed in both archive (zip and tar.gz) and installer program (rpm on Linux, dmg on Mac and exe on Windows).</p> <p>Choose the installer according to your operating system, e.g. Windows x64 Installer for Windows – the file name is <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jdk-14_windows-x64_bin.exe</span>.</p> <p>You should also verify the SHA256 checksum for the file downloaded, as described above. Then run the installer program. You will see the Java(TM) SE Development Kit 14 (64-bit) program appears as follows:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-14/oracle_jdk_installer.png" alt="oracle jdk installer" /></p> <p>Just click Next twice to install. The setup for Oracle JDK 14 using installer is quick and easy, but it doesn’t update the relevant system environment variables and do file associations. So you still need to manually update the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">PATH</span> (<a href="java-core/how-to-set-java-home-environment-variable-on-windows-10" target="_blank">See the instruction here</a>). For example:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME=C:\Program Files\Java\jdk-14</span></p> <p>Now in the command prompt, type the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span> command to check:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-14/oracle_jdk_java_version.png" alt="oracle jdk java version" /></p> <p>You see, JDK 14 is now installed on your computer.</p> <p>Watch the video:</p> <p>https://www.youtube.com/watch?v=Roz0ASAa1cg</p> <p>&nbsp;</p> <p>Next, you may need to configure your Eclipse IDE to experiment new language features in Java 14, follow these tutorials:</p> <ul> <li><a href="ides/eclipse/enable-java-14-for-eclipse" target="_blank">How to enable Java 14 support in Eclipse IDE 2020-03</a></li> <li><a href="https://www.youtube.com/watch?v=p7pr1-N3oug" rel="nofollow" target="_blank">[Video]&nbsp;Java 14 New Features Demos</a></li> </ul> <p>&nbsp;</p> <h3>Learn more:</h3> <ul> <li><a href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a href="java-core/how-to-write-compile-and-run-a-hello-world-java-program-for-beginners" target="_blank">How to write, compile and run a hello world Java program for beginners</a></li> <li><a href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div><div class="feed-description"><p>This article is a guide to download and install OpenJDK and Oracle JDK for <a href="java-se/java-14-new-features" target="_blank">Java 14</a> on Windows operating system.</p> <p>You know, Java Development Kit (JDK) 14 was released on March, 17<sup>th</sup> 2020 with two kinds of build: OpenJDK and Oracle JDK. OpenJDK is distributed under GPL license and Oracle JDK is distributed under Oracle Technology Network (OTN) license.</p> <p>&nbsp;</p> <h2>1. Download and Install OpenJDK 14</h2> <p>OpenJDK is a production-ready and open-source Java Development Kit, released under the GNU General Public License (GPL) version 2. That means you can freely use OpenJDK for personal, development and commercial use.</p> <p>Go to the official download page of OpenJDK 14: <a href="https://jdk.java.net/14/" rel="nofollow" target="_blank">https://jdk.java.net/14/</a></p> <p>Then choose the appropriate package for your operating system (Linux, MacOS or Windows). Note that OpenJDK comes with only archive file (zip or tar.gz), no installer program. For instance, the archive file for Windows is <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">openjdk-14_windows-x64_bin.zip</span> (~189MB).</p> <p>I strongly recommend you to verify the SHA256 checksum of the file downloaded. On Windows, type the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil</span> command like this:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil -hashfile openjdk-11.0.2_windows-x64_bin.zip SHA256</span></p> <p>Then compare the hash code generated with the one provided on the website. If both are identical, it’s safe to install and use.</p> <p>Then extract the archive file and update the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">PATH</span> or <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME</span> system environment variable pointing to the installation directory of JDK 14 (<a href="java-core/how-to-set-java-home-environment-variable-on-windows-10" target="_blank">Read the instruction here</a>). For example:</p> <p style="margin-left: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME=g:\JDK\OpenJDK\jdk-14</span></p> <p style="margin-left: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">PATH=%JAVA_HOME%\bin;…</span></p> <p style="margin-left: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">PATH= g:\JDK\OpenJDK\jdk-14\bin;…</span></p> <p>Then type the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span> command to verify. You should see the following screen:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-14/openjdk_java_version.png" alt="openjdk java version" /></p> <p>&nbsp;</p> <p>This means OpenJDK has been installed successfully.</p> <p>Watch the video:</p> <p>https://www.youtube.com/watch?v=TjNuyFOPPZE</p> <p>&nbsp;</p> <h2>2. Download and Install Oracle JDK 14</h2> <p>Oracle JDK is a commercial build for Java Development Kit. Oracle JDK is free for personal and development use, but you have to pay license fee for commercial use via Java SE subscription program.</p> <p>Click <a href="https://www.oracle.com/java/technologies/javase-jdk14-downloads.html" rel="nofollow" target="_blank">official Java SE download page</a> to download Oracle JDK which is distributed in both archive (zip and tar.gz) and installer program (rpm on Linux, dmg on Mac and exe on Windows).</p> <p>Choose the installer according to your operating system, e.g. Windows x64 Installer for Windows – the file name is <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jdk-14_windows-x64_bin.exe</span>.</p> <p>You should also verify the SHA256 checksum for the file downloaded, as described above. Then run the installer program. You will see the Java(TM) SE Development Kit 14 (64-bit) program appears as follows:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-14/oracle_jdk_installer.png" alt="oracle jdk installer" /></p> <p>Just click Next twice to install. The setup for Oracle JDK 14 using installer is quick and easy, but it doesn’t update the relevant system environment variables and do file associations. So you still need to manually update the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">PATH</span> (<a href="java-core/how-to-set-java-home-environment-variable-on-windows-10" target="_blank">See the instruction here</a>). For example:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME=C:\Program Files\Java\jdk-14</span></p> <p>Now in the command prompt, type the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span> command to check:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-14/oracle_jdk_java_version.png" alt="oracle jdk java version" /></p> <p>You see, JDK 14 is now installed on your computer.</p> <p>Watch the video:</p> <p>https://www.youtube.com/watch?v=Roz0ASAa1cg</p> <p>&nbsp;</p> <p>Next, you may need to configure your Eclipse IDE to experiment new language features in Java 14, follow these tutorials:</p> <ul> <li><a href="ides/eclipse/enable-java-14-for-eclipse" target="_blank">How to enable Java 14 support in Eclipse IDE 2020-03</a></li> <li><a href="https://www.youtube.com/watch?v=p7pr1-N3oug" rel="nofollow" target="_blank">[Video]&nbsp;Java 14 New Features Demos</a></li> </ul> <p>&nbsp;</p> <h3>Learn more:</h3> <ul> <li><a href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a href="java-core/how-to-write-compile-and-run-a-hello-world-java-program-for-beginners" target="_blank">How to write, compile and run a hello world Java program for beginners</a></li> <li><a href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div>Download and Install Java 8 on Windows2020-05-05T06:56:21-05:002020-05-05T06:56:21-05:00https://www.codejava.net/java-se/download-and-install-java-8-on-windowsNam Ha Minhhainatu@gmail.com<div class="feed-description"><p>In this article, I will guide you to download and install Java 8 (JDK 8) on Windows operating system. Though Java 8 is a quite old version (released in 2014), it is still in used by many organizations and preferred by many programmers. That’s why Oracle extends commercial support for JDK 8 until December 2030.</p> <p>To download JDK 8, head to <a href="https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html" rel="nofollow" target="_blank">Java SE Development Kit 8 Downloads</a> page and choose a download file suitable for your operating system. Oracle JDK 8 is distributed in archives (zip and targ.z) and installers (rpm for Linux, dmg for macOS and exe for Windows).</p> <p>For Windows 10 x64-bit, choose to download the file <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jdk-8u251-windows-x64.exe</span> file. You must login using an Oracle account (if you don’t have an Oracle account, then <a href="https://profile.oracle.com/myprofile/account/create-account.jspx" rel="nofollow" target="_blank">creating one</a> is free).</p> <p>I recommend you to verity the integrity of the downloaded by comparing SHA256 checksum of the file against the value published <a href="https://www.oracle.com/webfolder/s/digest/8u251checksum.html" rel="nofollow" target="_blank">here</a>. On Windows, type the following command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil -hashfile jdk-8u251-windows-x64.exe sha256</span></p> <p>If the generated SHA256 checksum value matches the one posted by Oracle, you’re safe to launch JDK 8 setup program. You will see this screen:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-8/jdk_8_setup.png" alt="jdk 8 setup" width="600" height="326" /></p> <p>Click Next twice to proceed the installation of Java 8. Then it also asks you to install JRE 8:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-8/jre8_setup.png" alt="jre8 setup" width="600" height="326" /></p> <p>Click Next to proceed and click Close when the setup done.</p> <p>Note that Oracle JDK 8 setup automatically updates the PATH system environment variable so if you type <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span> command in a Windows Command prompt, you would see this:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-8/java_8_version.png" alt="java 8 version" /></p> <p>That means you have successfully installed JDK 8 on your computer. For development with Java 8, you should configure <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> as described in <a href="java-core/how-to-set-java-home-environment-variable-on-windows-10" target="_blank">this guide</a>.</p> <p>For visual steps, you can watch the following video:</p> <p>https://www.youtube.com/watch?v=XsdvQD_SDvw<a href="https://www.youtube.com/watch?v=XsdvQD_SDvw"></a></p> <h3 style="font-family: 'Open Sans', sans-serif; color: #333333;">&nbsp;</h3> <h3 style="font-family: 'Open Sans', sans-serif; color: #333333;">Related Tutorials:</h3> <ul style="font-size: 14.3px;"> <li><a style="cursor: pointer;" href="java-se/download-and-install-jdk-14-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 14</a></li> <li><a style="cursor: pointer;" href="java-se/download-and-install-jdk-13-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 13</a></li> <li><a style="cursor: pointer;" href="java-se/download-and-install-jdk-12" target="_blank">Download and Install JDK 12</a></li> <li><a href="java-se/download-and-install-java-11-openjdk-and-oracle-jdk" target="_blank">Download and install JDK 11</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a style="cursor: pointer;" href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a style="cursor: pointer;" href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div><div class="feed-description"><p>In this article, I will guide you to download and install Java 8 (JDK 8) on Windows operating system. Though Java 8 is a quite old version (released in 2014), it is still in used by many organizations and preferred by many programmers. That’s why Oracle extends commercial support for JDK 8 until December 2030.</p> <p>To download JDK 8, head to <a href="https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html" rel="nofollow" target="_blank">Java SE Development Kit 8 Downloads</a> page and choose a download file suitable for your operating system. Oracle JDK 8 is distributed in archives (zip and targ.z) and installers (rpm for Linux, dmg for macOS and exe for Windows).</p> <p>For Windows 10 x64-bit, choose to download the file <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jdk-8u251-windows-x64.exe</span> file. You must login using an Oracle account (if you don’t have an Oracle account, then <a href="https://profile.oracle.com/myprofile/account/create-account.jspx" rel="nofollow" target="_blank">creating one</a> is free).</p> <p>I recommend you to verity the integrity of the downloaded by comparing SHA256 checksum of the file against the value published <a href="https://www.oracle.com/webfolder/s/digest/8u251checksum.html" rel="nofollow" target="_blank">here</a>. On Windows, type the following command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil -hashfile jdk-8u251-windows-x64.exe sha256</span></p> <p>If the generated SHA256 checksum value matches the one posted by Oracle, you’re safe to launch JDK 8 setup program. You will see this screen:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-8/jdk_8_setup.png" alt="jdk 8 setup" width="600" height="326" /></p> <p>Click Next twice to proceed the installation of Java 8. Then it also asks you to install JRE 8:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-8/jre8_setup.png" alt="jre8 setup" width="600" height="326" /></p> <p>Click Next to proceed and click Close when the setup done.</p> <p>Note that Oracle JDK 8 setup automatically updates the PATH system environment variable so if you type <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span> command in a Windows Command prompt, you would see this:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-8/java_8_version.png" alt="java 8 version" /></p> <p>That means you have successfully installed JDK 8 on your computer. For development with Java 8, you should configure <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> as described in <a href="java-core/how-to-set-java-home-environment-variable-on-windows-10" target="_blank">this guide</a>.</p> <p>For visual steps, you can watch the following video:</p> <p>https://www.youtube.com/watch?v=XsdvQD_SDvw<a href="https://www.youtube.com/watch?v=XsdvQD_SDvw"></a></p> <h3 style="font-family: 'Open Sans', sans-serif; color: #333333;">&nbsp;</h3> <h3 style="font-family: 'Open Sans', sans-serif; color: #333333;">Related Tutorials:</h3> <ul style="font-size: 14.3px;"> <li><a style="cursor: pointer;" href="java-se/download-and-install-jdk-14-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 14</a></li> <li><a style="cursor: pointer;" href="java-se/download-and-install-jdk-13-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 13</a></li> <li><a style="cursor: pointer;" href="java-se/download-and-install-jdk-12" target="_blank">Download and Install JDK 12</a></li> <li><a href="java-se/download-and-install-java-11-openjdk-and-oracle-jdk" target="_blank">Download and install JDK 11</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a style="cursor: pointer;" href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a style="cursor: pointer;" href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div>Download and Install JDK 12 (OpenJDK and Oracle JDK)2020-04-07T22:50:08-05:002020-04-07T22:50:08-05:00https://www.codejava.net/java-se/download-and-install-jdk-12Nam Ha Minhhainatu@gmail.com<div class="feed-description"><p>In this post, I will guide you how to download and install Java Development Kit (JDK) for Java SE 12 from the official source, on Windows operating system.</p> <p>You know, Oracle releases JDK 12 on 19 March 2019 with two kinds of build: OpenJDK and Oracle JDK. Note that JDK 12 was superseded and not recommended for production use. Only developers should use JDK 12 to debug issues in old systems.</p> <p>&nbsp;</p> <h2>1. Download and Install OpenJDK 12</h2> <p>OpenJDK 12 is an open-source distribution of Java SE 12. It is licensed under GNU General Public License version 2 (GPLv2), which means you can use OpenJDK for personal, development and commercial use.</p> <p>Since OpenJDK 12 was superseded, you can download it from <a href="https://jdk.java.net/archive/" rel="nofollow" target="_blank">Archived OpenJDK Releases</a> page.</p> <p>Scroll down a little bit and you will see the last build of OpenJDK 12 is 12.0.2:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-12/openjdk_12_archive.png" alt="openjdk 12 archive" width="520" height="149" /></p> <p>As you can see, OpenJDK 12 is distributed in zip and tar.gz archives for Windows, macOS and Linux. Download the file suitable for your operating system. For Windows, it is <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">openjdk-12.0.2_windows-x64_bin.zip</span> file.</p> <p>It’s strongly recommended to verify integrity of the downloaded file by comparing its SHA256 checksum with the <a href="https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_windows-x64_bin.zip.sha256" rel="nofollow" target="_blank">one</a> mentioned on OpenJDK website. On Windows, type the following command to generate SHA256 checksum for the downloaded file:</p> <p style="text-indent: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil -hashfile openjdk-12.0.2_windows-x64_bin.zip sha256</span></p> <p>If the checksums are equal, it’s safe to proceed.</p> <p>Extract the zip file to a directory and update the <span style="font-family: 'courier new', courier; font-size: 10pt; color: #800000;">JAVA_HOME</span> environment variable pointing to the new JDK directory, using the following command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">setx -m JAVA_HOME "G:\OpenJDK\jdk-12.0.2"</span></p> <p>You need to run the Windows command prompt under administrator privilege to execute this command. And make sure the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">PATH</span> environment variables includes the entry <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME\bin</span>.</p> <p>Then open another command prompt window and type <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span> to check:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-12/openjdk_12_java_version.png" alt="openjdk 12 java version" /></p> <p>This means you have successfully installed OpenJDK 12.</p> <p>Watch the video:&nbsp;</p> <p>https://www.youtube.com/watch?v=25RQtazHOhM</p> <p>&nbsp;</p> <h2>2. Download and Install Oracle JDK 12</h2> <p>Oracle JDK 12 was a commercial build for Java SE 12 but it was superseded. Oracle JDK 12 is not recommended for production use. Only programmers should use it to debug issues in old systems.</p> <p>To download Oracle JDK 12, you need to go to Oracle Java Archive Downloads page. Scroll down a little bit and click the link <a href="https://www.oracle.com/java/technologies/oracle-java-archive-downloads.html" rel="nofollow" target="_blank">Java SE 12 Archive Downloads</a>. You can see Oracle JDK 12 is provided with both archive files (zip and tar.gz) and installers for Linux, macOS and Windows.</p> <p>For Windows, you can download the installer program <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jdk-12.0.2_windows-x64_bin.exe</span>. Note that you must have an Oracle account and sign in to download.</p> <p>Click the downloaded file to launch the installer program for Oracle JDK 12. You will see the following wizard appears:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-12/oracle_jdk_12_setup.png" alt="oracle jdk 12 setup" /></p> <p>Just click Next twice to start installing. It will be very quick, simple and easy.</p> <p>Then type the following command to update the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> environment variable (requires administrator privilege):</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">setx -m JAVA_HOME "C:\Program Files\Java\jdk-12.0.2"</span></p> <p>Also make sure to include <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME\bin</span> in the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">PATH</span> variable:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">setx -m PATH "%PATH%;%JAVA_HOME%\bin";</span></p> <p>Finally, open a new command prompt and type <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version </span>to verify:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-12/oracle_jdk_12_java_version.png" alt="oracle jdk 12 java version" /></p> <p>That means you have successfully installed Oracle JDK 12.</p> <p>Watch video:</p> <p>https://www.youtube.com/watch?v=aghEF1ak8sY</p> <p>&nbsp;</p> <h3>Related Tutorials:</h3> <ul> <li><a href="java-se/download-and-install-jdk-14-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 14 (OpenJDK and Oracle JDK)</a></li> <li><a href="java-se/download-and-install-jdk-13-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 13 (OpenJDK and Oracle JDK)</a></li> <li><a href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> </ul></div><div class="feed-description"><p>In this post, I will guide you how to download and install Java Development Kit (JDK) for Java SE 12 from the official source, on Windows operating system.</p> <p>You know, Oracle releases JDK 12 on 19 March 2019 with two kinds of build: OpenJDK and Oracle JDK. Note that JDK 12 was superseded and not recommended for production use. Only developers should use JDK 12 to debug issues in old systems.</p> <p>&nbsp;</p> <h2>1. Download and Install OpenJDK 12</h2> <p>OpenJDK 12 is an open-source distribution of Java SE 12. It is licensed under GNU General Public License version 2 (GPLv2), which means you can use OpenJDK for personal, development and commercial use.</p> <p>Since OpenJDK 12 was superseded, you can download it from <a href="https://jdk.java.net/archive/" rel="nofollow" target="_blank">Archived OpenJDK Releases</a> page.</p> <p>Scroll down a little bit and you will see the last build of OpenJDK 12 is 12.0.2:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-12/openjdk_12_archive.png" alt="openjdk 12 archive" width="520" height="149" /></p> <p>As you can see, OpenJDK 12 is distributed in zip and tar.gz archives for Windows, macOS and Linux. Download the file suitable for your operating system. For Windows, it is <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">openjdk-12.0.2_windows-x64_bin.zip</span> file.</p> <p>It’s strongly recommended to verify integrity of the downloaded file by comparing its SHA256 checksum with the <a href="https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_windows-x64_bin.zip.sha256" rel="nofollow" target="_blank">one</a> mentioned on OpenJDK website. On Windows, type the following command to generate SHA256 checksum for the downloaded file:</p> <p style="text-indent: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil -hashfile openjdk-12.0.2_windows-x64_bin.zip sha256</span></p> <p>If the checksums are equal, it’s safe to proceed.</p> <p>Extract the zip file to a directory and update the <span style="font-family: 'courier new', courier; font-size: 10pt; color: #800000;">JAVA_HOME</span> environment variable pointing to the new JDK directory, using the following command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">setx -m JAVA_HOME "G:\OpenJDK\jdk-12.0.2"</span></p> <p>You need to run the Windows command prompt under administrator privilege to execute this command. And make sure the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">PATH</span> environment variables includes the entry <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME\bin</span>.</p> <p>Then open another command prompt window and type <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span> to check:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-12/openjdk_12_java_version.png" alt="openjdk 12 java version" /></p> <p>This means you have successfully installed OpenJDK 12.</p> <p>Watch the video:&nbsp;</p> <p>https://www.youtube.com/watch?v=25RQtazHOhM</p> <p>&nbsp;</p> <h2>2. Download and Install Oracle JDK 12</h2> <p>Oracle JDK 12 was a commercial build for Java SE 12 but it was superseded. Oracle JDK 12 is not recommended for production use. Only programmers should use it to debug issues in old systems.</p> <p>To download Oracle JDK 12, you need to go to Oracle Java Archive Downloads page. Scroll down a little bit and click the link <a href="https://www.oracle.com/java/technologies/oracle-java-archive-downloads.html" rel="nofollow" target="_blank">Java SE 12 Archive Downloads</a>. You can see Oracle JDK 12 is provided with both archive files (zip and tar.gz) and installers for Linux, macOS and Windows.</p> <p>For Windows, you can download the installer program <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jdk-12.0.2_windows-x64_bin.exe</span>. Note that you must have an Oracle account and sign in to download.</p> <p>Click the downloaded file to launch the installer program for Oracle JDK 12. You will see the following wizard appears:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-12/oracle_jdk_12_setup.png" alt="oracle jdk 12 setup" /></p> <p>Just click Next twice to start installing. It will be very quick, simple and easy.</p> <p>Then type the following command to update the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> environment variable (requires administrator privilege):</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">setx -m JAVA_HOME "C:\Program Files\Java\jdk-12.0.2"</span></p> <p>Also make sure to include <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME\bin</span> in the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">PATH</span> variable:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">setx -m PATH "%PATH%;%JAVA_HOME%\bin";</span></p> <p>Finally, open a new command prompt and type <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version </span>to verify:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-12/oracle_jdk_12_java_version.png" alt="oracle jdk 12 java version" /></p> <p>That means you have successfully installed Oracle JDK 12.</p> <p>Watch video:</p> <p>https://www.youtube.com/watch?v=aghEF1ak8sY</p> <p>&nbsp;</p> <h3>Related Tutorials:</h3> <ul> <li><a href="java-se/download-and-install-jdk-14-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 14 (OpenJDK and Oracle JDK)</a></li> <li><a href="java-se/download-and-install-jdk-13-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 13 (OpenJDK and Oracle JDK)</a></li> <li><a href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> </ul></div>Download and Install JDK 13 (OpenJDK and Oracle JDK)2020-04-02T00:57:20-05:002020-04-02T00:57:20-05:00https://www.codejava.net/java-se/download-and-install-jdk-13-openjdk-and-oracle-jdkNam Ha Minhhainatu@gmail.com<div class="feed-description"><p>In this post, I will guide you how to download and setup JDK 13 on Windows operating system for both OpenJDK and Oracle JDK builds – so you can experiment the new language features in Java 13 like switch expressions, text blocks, etc.</p> <p>Note that both OpenJDK and Oracle JDK made by Oracle, but they are distributed with different licenses.</p> <p>&nbsp;</p> <h2>1. Download and Install OpenJDK 13</h2> <p>OpenJDK 13 is a reference implementation of Java SE 13 which was officially release on September, 17<sup>th</sup> 2019. OpenJDK is free for personal, development and commercial use under GNU General Public License (GPLv2) without technical support.</p> <p>Head to the official download page of OpenJDK 13: <a href="http://jdk.java.net/java-se-ri/13" rel="nofollow" target="_blank">http://jdk.java.net/java-se-ri/13</a></p> <p>You can see there are two binary builds: one for Oracle Linux and one for Windows 10 x64. For Windows, you will download the file <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">openjdk-13+33_windows-x64_bin.zip</span>. (~186 MB).</p> <p>You should verify integrity of the downloaded file by comparing SHA256 checksum of the zip file with the <a href="https://download.java.net/openjdk/jdk13/ri/openjdk-13+33_windows-x64_bin.zip.sha256" rel="nofollow" target="_blank">one</a> published on the website. On Windows, run this command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil -hashfile openjdk-13+33_windows-x64_bin.zip SHA256</span></p> <p>Then compare the checksum code generated with the SHA256 code on the website. If both are equal, you can proceed.</p> <p>OpenJDK doesn’t have an installer, so you need to extract the downloaded zip file and update the system environment variables accordingly (<a href="java-core/how-to-set-java-home-environment-variable-on-windows-10" target="_blank">see the instructions here</a>):</p> <p style="margin-left: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME = G:\JDK\OpenJDK\jdk-13</span></p> <p style="margin-left: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New';">PATH = %JAVA_HOME%\bin;…</span></p> <p>Or:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">PATH = G:\JDK\OpenJDK\jdk-13\bin;…</span></p> <p>Then type <span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span> command in a command prompt window to verify:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-13/open_jdk_13_version.png" alt="open jdk 13 version" /></p> <p>You see, it prints ‘openjdk version “13” 2019-09-17’ which means you have successfully installed OpenJDK 13. Next, you may need to configure Eclipse IDE to run under the new JDK (<a href="ides/eclipse/how-to-run-eclipse-under-different-version-of-jdk-or-jre" target="_blank">see how</a>). You can also watch the video below:</p> <p>https://www.youtube.com/watch?v=bxE5ZMiSAdI</p> <p>&nbsp;</p> <h2>2. Download and Install Oracle JDK 13</h2> <p>Oracle JDK is a commercial build for Java Development Kit with paid technical support for long term. But you can use Oracle JDK for personal and development use at no cost.</p> <p>To download Oracle JDK 13, go to its official <a href="https://www.oracle.com/java/technologies/javase-jdk13-downloads.html" rel="nofollow" target="_blank">Java SE 13 download page</a>. You can see Oracle JDK comes with installers for different operating systems, as well as compressed archive files. For Windows, choose to download Windows x64 Installer.</p> <p>Then you will download the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jdk-13.0.2_windows-x64_bin.exe</span> file (~160 MB), and verify SHA256 <a href="https://www.oracle.com/webfolder/s/digest/13-0-2-checksum.html" rel="nofollow" target="_blank">checksum</a> for the downloaded file using this command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil -hashfile jdk-13.0.2_windows-x64_bin.exe sha256</span></p> <p>Run the Oracle JDK 13 installer program and you will see the following screen:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-13/oracle_jdk_13_setup.png" alt="oracle jdk 13 setup" /></p> <p>The setup for Oracle JDK 13 is simple, quick and easy. Just click Next twice to proceed the installation. However, you still have to update the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> or <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">PATH</span> system environment variables (<a href="java-core/how-to-set-java-home-environment-variable-on-windows-10" target="_blank">see how</a>) pointing to the new JDK:</p> <p style="text-indent: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME = C:\Program Files\Java\jdk-13.0.2</span></p> <p>And then type <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';"><span style="color: #800000;">java –version</span>&nbsp;</span>command to check:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-13/oracle_jdk_13_version.png" alt="oracle jdk 13 version" /></p> <p>Now, Oracle JDK 13 has been installed successfully on your computer.</p> <p>Next, you may need to <a href="ides/eclipse/how-to-run-eclipse-under-different-version-of-jdk-or-jre" target="_blank">configure Eclipse</a> IDE to run under the new JDK.</p> <p>Watch the video:</p> <p>https://www.youtube.com/watch?v=2kCnWHCIzFE</p> <p>&nbsp;</p> <h3 style="font-family: 'Open Sans', sans-serif; color: #333333;">Learn more:</h3> <ul style="font-size: 14.3px;"> <li><a style="color: #095197; cursor: pointer;" href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a style="color: #095197; cursor: pointer;" href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a style="color: #095197; cursor: pointer;" href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a style="color: #095197; cursor: pointer;" href="java-core/how-to-write-compile-and-run-a-hello-world-java-program-for-beginners" target="_blank">How to write, compile and run a hello world Java program for beginners</a></li> <li><a style="color: #095197; cursor: pointer;" href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div><div class="feed-description"><p>In this post, I will guide you how to download and setup JDK 13 on Windows operating system for both OpenJDK and Oracle JDK builds – so you can experiment the new language features in Java 13 like switch expressions, text blocks, etc.</p> <p>Note that both OpenJDK and Oracle JDK made by Oracle, but they are distributed with different licenses.</p> <p>&nbsp;</p> <h2>1. Download and Install OpenJDK 13</h2> <p>OpenJDK 13 is a reference implementation of Java SE 13 which was officially release on September, 17<sup>th</sup> 2019. OpenJDK is free for personal, development and commercial use under GNU General Public License (GPLv2) without technical support.</p> <p>Head to the official download page of OpenJDK 13: <a href="http://jdk.java.net/java-se-ri/13" rel="nofollow" target="_blank">http://jdk.java.net/java-se-ri/13</a></p> <p>You can see there are two binary builds: one for Oracle Linux and one for Windows 10 x64. For Windows, you will download the file <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">openjdk-13+33_windows-x64_bin.zip</span>. (~186 MB).</p> <p>You should verify integrity of the downloaded file by comparing SHA256 checksum of the zip file with the <a href="https://download.java.net/openjdk/jdk13/ri/openjdk-13+33_windows-x64_bin.zip.sha256" rel="nofollow" target="_blank">one</a> published on the website. On Windows, run this command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil -hashfile openjdk-13+33_windows-x64_bin.zip SHA256</span></p> <p>Then compare the checksum code generated with the SHA256 code on the website. If both are equal, you can proceed.</p> <p>OpenJDK doesn’t have an installer, so you need to extract the downloaded zip file and update the system environment variables accordingly (<a href="java-core/how-to-set-java-home-environment-variable-on-windows-10" target="_blank">see the instructions here</a>):</p> <p style="margin-left: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME = G:\JDK\OpenJDK\jdk-13</span></p> <p style="margin-left: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New';">PATH = %JAVA_HOME%\bin;…</span></p> <p>Or:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';">PATH = G:\JDK\OpenJDK\jdk-13\bin;…</span></p> <p>Then type <span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span> command in a command prompt window to verify:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-13/open_jdk_13_version.png" alt="open jdk 13 version" /></p> <p>You see, it prints ‘openjdk version “13” 2019-09-17’ which means you have successfully installed OpenJDK 13. Next, you may need to configure Eclipse IDE to run under the new JDK (<a href="ides/eclipse/how-to-run-eclipse-under-different-version-of-jdk-or-jre" target="_blank">see how</a>). You can also watch the video below:</p> <p>https://www.youtube.com/watch?v=bxE5ZMiSAdI</p> <p>&nbsp;</p> <h2>2. Download and Install Oracle JDK 13</h2> <p>Oracle JDK is a commercial build for Java Development Kit with paid technical support for long term. But you can use Oracle JDK for personal and development use at no cost.</p> <p>To download Oracle JDK 13, go to its official <a href="https://www.oracle.com/java/technologies/javase-jdk13-downloads.html" rel="nofollow" target="_blank">Java SE 13 download page</a>. You can see Oracle JDK comes with installers for different operating systems, as well as compressed archive files. For Windows, choose to download Windows x64 Installer.</p> <p>Then you will download the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jdk-13.0.2_windows-x64_bin.exe</span> file (~160 MB), and verify SHA256 <a href="https://www.oracle.com/webfolder/s/digest/13-0-2-checksum.html" rel="nofollow" target="_blank">checksum</a> for the downloaded file using this command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil -hashfile jdk-13.0.2_windows-x64_bin.exe sha256</span></p> <p>Run the Oracle JDK 13 installer program and you will see the following screen:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-13/oracle_jdk_13_setup.png" alt="oracle jdk 13 setup" /></p> <p>The setup for Oracle JDK 13 is simple, quick and easy. Just click Next twice to proceed the installation. However, you still have to update the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> or <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">PATH</span> system environment variables (<a href="java-core/how-to-set-java-home-environment-variable-on-windows-10" target="_blank">see how</a>) pointing to the new JDK:</p> <p style="text-indent: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New';">JAVA_HOME = C:\Program Files\Java\jdk-13.0.2</span></p> <p>And then type <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';"><span style="color: #800000;">java –version</span>&nbsp;</span>command to check:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/install-jdk-13/oracle_jdk_13_version.png" alt="oracle jdk 13 version" /></p> <p>Now, Oracle JDK 13 has been installed successfully on your computer.</p> <p>Next, you may need to <a href="ides/eclipse/how-to-run-eclipse-under-different-version-of-jdk-or-jre" target="_blank">configure Eclipse</a> IDE to run under the new JDK.</p> <p>Watch the video:</p> <p>https://www.youtube.com/watch?v=2kCnWHCIzFE</p> <p>&nbsp;</p> <h3 style="font-family: 'Open Sans', sans-serif; color: #333333;">Learn more:</h3> <ul style="font-size: 14.3px;"> <li><a style="color: #095197; cursor: pointer;" href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a style="color: #095197; cursor: pointer;" href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a style="color: #095197; cursor: pointer;" href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a style="color: #095197; cursor: pointer;" href="java-core/how-to-write-compile-and-run-a-hello-world-java-program-for-beginners" target="_blank">How to write, compile and run a hello world Java program for beginners</a></li> <li><a style="color: #095197; cursor: pointer;" href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div>Java 15 - Download and Install OpenJDK 152020-09-24T00:05:34-05:002020-09-24T00:05:34-05:00https://www.codejava.net/java-se/download-and-install-openjdk-15Nam Ha Minhhainatu@gmail.com<div class="feed-description"><p>Java 15 was out, available to the public on September 15<sup>th</sup> 2020. In this article, I will help you get started experimenting Java 15 with OpenJDK – an open-source distribution of Java SE Development Kit: download and install OpenJDK 15 on Windows operating system.</p> <p>OpenJDK is licensed under GNU General Public License version 2, which means developers can use it for personal and commercial use.</p> <p>&nbsp;</p> <h2>1. Download OpenJDK 15</h2> <p>OpenJDK is distributed as a zip archive for Windows (no installer program). So head over to <a href="http://jdk.java.net/15/" rel="nofollow" target="_blank">OpenJDK 15 homepage</a> to download it, or click this direct <a href="https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL/openjdk-15_windows-x64_bin.zip" rel="nofollow" target="_blank">OpenJDK 15 download link</a>. You will get a file named <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">openjdk-15_windows-x64_bin.zip</span> downloaded onto your computer.</p> <p>After download, I strongly recommend you to use the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil</span> in Windows to verify the file’s SHA256 checksum – by running this command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil –hashfile openjdk-15_windows-x64_bin.zip SHA256</span></p> <p>Compare the outputted value with the one published <a href="https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL/openjdk-15_windows-x64_bin.zip.sha256" rel="nofollow" target="_blank">here</a>. If both matches, it’s safely to use the downloaded zip file.</p> <p>&nbsp;</p> <h2>2. Install OpenJDK 15</h2> <p>Extract the downloaded zip file to a separate directory on your computer, say in <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">D:\OpenJDK15</span>, then you will get the home directory of OpenJDK 15 is <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">D:\OpenJDK15\jdk-15</span>.</p> <p>Then you need to update the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">PATH</span> environment variables as follows:</p> <p style="margin-left: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME= D:\OpenJDK15\jdk-15</span></p> <p style="margin-left: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">PATH=%JAVA_HOME%\bin;…</span></p> <p>You can follow <a href="https://www.youtube.com/watch?v=104dNWmM6Rs" rel="nofollow" target="_blank">this video</a> on how to set environment variables for Java.</p> <p><span style="font-size: 11pt; line-height: 107%; font-family: Calibri, sans-serif;">Then open a new command prompt window, type the command <strong>java –version</strong> to check. You should see this screen:</span></p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/java_version_openjdk_15.png" alt="java version openjdk 15" /></p> <p>This means you have successfully installed OpenJDK 15 and configured the environment properly.</p> <p>To see the download and installation of OpenJDK 15 in action, watch the video below:</p> <p>https://www.youtube.com/watch?v=-WKcMw_d26I</p> <p>&nbsp;</p> <h3 style="font-family: 'Open Sans', sans-serif; color: #333333;">Learn more:</h3> <ul style="font-size: 14.3px;"> <li><a style="cursor: pointer;" href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a style="cursor: pointer;" href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-write-compile-and-run-a-hello-world-java-program-for-beginners" target="_blank">How to write, compile and run a hello world Java program for beginners</a></li> <li><a style="cursor: pointer;" href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div><div class="feed-description"><p>Java 15 was out, available to the public on September 15<sup>th</sup> 2020. In this article, I will help you get started experimenting Java 15 with OpenJDK – an open-source distribution of Java SE Development Kit: download and install OpenJDK 15 on Windows operating system.</p> <p>OpenJDK is licensed under GNU General Public License version 2, which means developers can use it for personal and commercial use.</p> <p>&nbsp;</p> <h2>1. Download OpenJDK 15</h2> <p>OpenJDK is distributed as a zip archive for Windows (no installer program). So head over to <a href="http://jdk.java.net/15/" rel="nofollow" target="_blank">OpenJDK 15 homepage</a> to download it, or click this direct <a href="https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL/openjdk-15_windows-x64_bin.zip" rel="nofollow" target="_blank">OpenJDK 15 download link</a>. You will get a file named <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">openjdk-15_windows-x64_bin.zip</span> downloaded onto your computer.</p> <p>After download, I strongly recommend you to use the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil</span> in Windows to verify the file’s SHA256 checksum – by running this command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil –hashfile openjdk-15_windows-x64_bin.zip SHA256</span></p> <p>Compare the outputted value with the one published <a href="https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL/openjdk-15_windows-x64_bin.zip.sha256" rel="nofollow" target="_blank">here</a>. If both matches, it’s safely to use the downloaded zip file.</p> <p>&nbsp;</p> <h2>2. Install OpenJDK 15</h2> <p>Extract the downloaded zip file to a separate directory on your computer, say in <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">D:\OpenJDK15</span>, then you will get the home directory of OpenJDK 15 is <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">D:\OpenJDK15\jdk-15</span>.</p> <p>Then you need to update the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">PATH</span> environment variables as follows:</p> <p style="margin-left: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME= D:\OpenJDK15\jdk-15</span></p> <p style="margin-left: 0.5in;"><span style="font-size: 9pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">PATH=%JAVA_HOME%\bin;…</span></p> <p>You can follow <a href="https://www.youtube.com/watch?v=104dNWmM6Rs" rel="nofollow" target="_blank">this video</a> on how to set environment variables for Java.</p> <p><span style="font-size: 11pt; line-height: 107%; font-family: Calibri, sans-serif;">Then open a new command prompt window, type the command <strong>java –version</strong> to check. You should see this screen:</span></p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/java_version_openjdk_15.png" alt="java version openjdk 15" /></p> <p>This means you have successfully installed OpenJDK 15 and configured the environment properly.</p> <p>To see the download and installation of OpenJDK 15 in action, watch the video below:</p> <p>https://www.youtube.com/watch?v=-WKcMw_d26I</p> <p>&nbsp;</p> <h3 style="font-family: 'Open Sans', sans-serif; color: #333333;">Learn more:</h3> <ul style="font-size: 14.3px;"> <li><a style="cursor: pointer;" href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a style="cursor: pointer;" href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-write-compile-and-run-a-hello-world-java-program-for-beginners" target="_blank">How to write, compile and run a hello world Java program for beginners</a></li> <li><a style="cursor: pointer;" href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div>Java 15 – Download and Install Oracle JDK 152020-09-24T01:58:02-05:002020-09-24T01:58:02-05:00https://www.codejava.net/java-se/download-and-install-oracle-jdk-15Nam Ha Minhhainatu@gmail.com<div class="feed-description"><p>This article will guide you how to download and install Oracle JDK 15 – a commercial distribution of Java Development Kit – to get started with Java 15 development on Windows operating system.</p> <p>Oracle JDK 15 is licensed under Oracle Technology Network (OTN) license. You can use it freely for personal and non-commercial use. For commercial use, you need to pay for a license in terms of Java SE subscription program.</p> <p>&nbsp;</p> <h2>1. Download Oracle JDK 15</h2> <p>Oracle JDK 15 is distributed in archive files (tar.gz and zip) and installer programs for popular operating systems like Windows, Linux and Mac. For Windows, I recommend you to download a setup program which makes the installation easy (automatic update environment variables and file associations).</p> <p>So head over to Oracle’s official <a href="https://www.oracle.com/java/technologies/javase-jdk15-downloads.html" rel="nofollow" target="_blank">Java SE Download page</a>, and choose to download Windows x64 Installer. Then you will get a file named <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jdk-15_windows-x64_bin.exe</span> downloaded onto your computer.</p> <p>After download, I recommend you to verify the integrity of the downloaded file by running the following command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 12pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil –hashfile jdk-15_windows-x64_bin.exe SHA256</span></p> <p>Then compare the outputted SHA256 value with the one published on Oracle’s website <a href="https://www.oracle.com/webfolder/s/digest/15checksum.html" rel="nofollow" target="_blank">here</a>. If two checksums match, you can safely run the setup program.</p> <p>&nbsp;</p> <h2>2. Install Oracle JDK 15</h2> <p>Double click the downloaded EXE file to launch setup program for Oracle JDK 15. You will see this dialog appears:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/Oracle_JDK_15_setup.png" alt="Oracle JDK 15 setup" /></p> <p>Just click Next two times to proceed the installation with default settings. It will install Oracle JDK 15 quickly. And finally click Close to complete the installation.</p> <p>Now, open a new command prompt window and type the command <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span>, you will see the version information of JDK like this:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/oracle_java_version_15.png" alt="oracle java version 15" /></p> <p>This means you have successfully installed Oracle JDK 15 on your computer. Note that the installer has updated the environment variables <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">PATH</span> behind the scene. So it’s very convenient.</p> <p>To see the download and installation of Oracle JDK 15 in action, you can follow the video below:</p> <p>https://www.youtube.com/watch?v=1YdE5zhiBLs</p> <p>&nbsp;</p> <h3 style="font-family: 'Open Sans', sans-serif; color: #333333;">Learn more:</h3> <ul style="font-size: 14.3px;"> <li><a style="cursor: pointer;" href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a style="cursor: pointer;" href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-write-compile-and-run-a-hello-world-java-program-for-beginners" target="_blank">How to write, compile and run a hello world Java program for beginners</a></li> <li><a style="cursor: pointer;" href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div><div class="feed-description"><p>This article will guide you how to download and install Oracle JDK 15 – a commercial distribution of Java Development Kit – to get started with Java 15 development on Windows operating system.</p> <p>Oracle JDK 15 is licensed under Oracle Technology Network (OTN) license. You can use it freely for personal and non-commercial use. For commercial use, you need to pay for a license in terms of Java SE subscription program.</p> <p>&nbsp;</p> <h2>1. Download Oracle JDK 15</h2> <p>Oracle JDK 15 is distributed in archive files (tar.gz and zip) and installer programs for popular operating systems like Windows, Linux and Mac. For Windows, I recommend you to download a setup program which makes the installation easy (automatic update environment variables and file associations).</p> <p>So head over to Oracle’s official <a href="https://www.oracle.com/java/technologies/javase-jdk15-downloads.html" rel="nofollow" target="_blank">Java SE Download page</a>, and choose to download Windows x64 Installer. Then you will get a file named <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jdk-15_windows-x64_bin.exe</span> downloaded onto your computer.</p> <p>After download, I recommend you to verify the integrity of the downloaded file by running the following command:</p> <p style="text-indent: 0.5in;"><span style="font-size: 12pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">certutil –hashfile jdk-15_windows-x64_bin.exe SHA256</span></p> <p>Then compare the outputted SHA256 value with the one published on Oracle’s website <a href="https://www.oracle.com/webfolder/s/digest/15checksum.html" rel="nofollow" target="_blank">here</a>. If two checksums match, you can safely run the setup program.</p> <p>&nbsp;</p> <h2>2. Install Oracle JDK 15</h2> <p>Double click the downloaded EXE file to launch setup program for Oracle JDK 15. You will see this dialog appears:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/Oracle_JDK_15_setup.png" alt="Oracle JDK 15 setup" /></p> <p>Just click Next two times to proceed the installation with default settings. It will install Oracle JDK 15 quickly. And finally click Close to complete the installation.</p> <p>Now, open a new command prompt window and type the command <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java –version</span>, you will see the version information of JDK like this:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/oracle_java_version_15.png" alt="oracle java version 15" /></p> <p>This means you have successfully installed Oracle JDK 15 on your computer. Note that the installer has updated the environment variables <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">JAVA_HOME</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">PATH</span> behind the scene. So it’s very convenient.</p> <p>To see the download and installation of Oracle JDK 15 in action, you can follow the video below:</p> <p>https://www.youtube.com/watch?v=1YdE5zhiBLs</p> <p>&nbsp;</p> <h3 style="font-family: 'Open Sans', sans-serif; color: #333333;">Learn more:</h3> <ul style="font-size: 14.3px;"> <li><a style="cursor: pointer;" href="java-core/how-to-check-java-version" target="_blank">How to check Java version</a></li> <li><a style="cursor: pointer;" href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-set-environment-variables-for-java-using-command-line" target="_blank">How to set environment variables for Java using command line</a></li> <li><a style="cursor: pointer;" href="java-core/how-to-write-compile-and-run-a-hello-world-java-program-for-beginners" target="_blank">How to write, compile and run a hello world Java program for beginners</a></li> <li><a style="cursor: pointer;" href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div>Java 14: What’s New, Deprecated and Removed2020-03-23T21:15:14-05:002020-03-23T21:15:14-05:00https://www.codejava.net/java-se/java-14-new-featuresNam Ha Minhhainatu@gmail.com<div class="feed-description"><p>Java 14 was released on March 17<sup>th</sup> 2020 with some interesting new features added to the language – notably the finalization of switch expression enhancements, which leads to addition of the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">yield</span> keyword. Another cool stuff is that, JDK 14 comes with a new packaging tool called <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jpackage</span>– allows programmers to create native installer for Java applications.</p> <p>And like previous Java releases, performance for the Java Virtual Machine (JVM) is continuously improved with several updates for garbage collectors. Among that, something is deprecated for removal in future as well as some other things are actually removed in JDK 14.</p> <p><strong>Table of content:</strong></p> <p style="margin-left: 30px;"><a href="#LanguageFeatures">1. New Language Features in Java 14</a></p> <p style="margin-left: 30px;"><a href="#ToolsAPI">2. Updates for Tools and APIs in Java 14</a></p> <p style="margin-left: 30px;"><a href="#JVM">3. JVM Performance Improvements in JDK 14</a></p> <p style="margin-left: 30px;"><a href="#Deprecated">4. What’s Deprecated in JDK 14</a></p> <p style="margin-left: 30px;"><a href="#Removed">5. What’s Removed in JDK 14</a></p> <p>Now, let’s dive into the details for what’s new, deprecated in removed in Java 14.</p> <p>&nbsp;</p> <h2><a name="LanguageFeatures">1. New Language Features in Java 14</a></h2> <p>Enhancements for switch expressions become standard, whilst Text blocks, Records and Pattern matching for instanceof are still in preview.</p> <h3><span style="line-height: 107%;">Switch Expression Enhancements:</span></h3> <p>The switch-case expression in Java is well-known for its verbosity for multiple-case fall through. Consider the following method:</p> <pre class="brush:java">public void dayOfMonth(int month) { switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println("this month has 31 days"); break; case 2: System.out.println("this month has 28 or 29 days"); break; case 4: case 6: case 9: case 11: System.out.println("this month has 30 days"); break; default: System.out.println("invalid month number"); } }</pre> <p>This is clearly very verbose. Now with Java 14’s enhancements for switch expression, we can rewrite this method as follows:</p> <pre class="brush:java">public static void dayOfMonth(int month) { switch (month) { case 1, 3, 5, 7, 8, 10, 12 -&gt; System.out.println("this month has 31 days"); case 4, 6, 9, 11 -&gt; System.out.println("this month has 30 days"); case 2 -&gt; System.out.println("this month probably has 28 days"); default -&gt; System.out.println("invalid month number"); } }</pre> <p>You see, it’s much clearer and more readable, isn’t it?</p> <p>Moreover, the switch block can return a value to be used in an expression like this:</p> <pre class="brush:java">int days = switch(month) { case 1, 3, 5, 7, 8, 10, 12 -&gt; 31; case 4, 6, 9, 11 -&gt; 30; case 2 -&gt; 28; default -&gt; 0; };</pre> <p>If the code in a case is a block, we can use the yield keyword to return the value, for example:</p> <pre class="brush:java">int days = switch(month) { case 1, 3, 5, 7, 8, 10, 12 -&gt; 31; case 4, 6, 9, 11 -&gt; 30; case 2 -&gt; { System.out.print("Enter year: "); Scanner scanner = new Scanner(System.in); int year = scanner.nextInt(); if (year % 4 == 0) yield 29; else yield 28; } default -&gt; 0; };</pre> <p>So, since Java 14, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">yield</span> becomes the keyword used in switch expression to return a value. Read the JDK Enhancement Proposal <a href="https://openjdk.java.net/jeps/361" rel="nofollow" target="_blank">JEP 361</a> that covers the full detailed of enhancements for switch expression.</p> <p>For more code examples with detailed explanation, read this post&nbsp;<a href="java-core/the-java-language/switch-expression-examples" target="_blank">Java 14: Switch Expressions Enhancements Examples</a>.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Text Blocks (preview):</span></h3> <p>This feature allows programmers to write lengthy String literals in a way that is more readable and effortlessly. Consider the following String literal:</p> <pre class="brush:java">String html = "&lt;html&gt;\n" + " &lt;head&gt;\n" + " &lt;title&gt;Homepage&lt;/title&gt;\n" + " &lt;/head&gt;\n" + " &lt;body&gt;\n" + " &lt;h1&gt;This is the homepage&lt;/h1&gt;\n" + " &lt;/body&gt;\n" + "&lt;/html&gt;\n";</pre> <p>From Java 14, you can rewrite this String literal as follows:</p> <pre class="brush:java">String html = """ &lt;html&gt; &lt;head&gt; &lt;title&gt;Homepage&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;This is the homepage&lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; """;</pre> <p>You see, it looks much more naturally, right? A text bock starts with 3 double quotes follow by a new line character, and ends with 3 double quotes.</p> <p>With text block, you don’t have to escape special characters like new lines or double quotes. Note that the Java compiler will automatically trim the leading spaces in a text block, making it more convenient for programmers.</p> <p>Read the <a href="https://openjdk.java.net/jeps/368" rel="nofollow" target="_blank">JEP 368</a> that describes text block in full details.</p> <p><strong>Update</strong>: Text blocks become a standard feature in JDK 15. Learn more:&nbsp;<a href="java-core/the-java-language/text-blocks-example" target="_blank">Understand Text Blocks Feature in Java 15?</a></p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Records (preview):</span></h3> <p>Records are a new kind of type declaration in the Java language. It simplifies the coding of classes that merely act as “data carrier” i.e. domain classes or POJO classes. Consider the following class:</p> <pre class="brush:java">public class Book { private String title; private String author; public Book(String title, String author) { this.title = title; this.author = author; } public void setTitle(String title) { this.title = title; } public String getTitle() { return this.title; } public void setAuthor(String author) { this.author = author; } public String getAuthor() { return this.author; } } </pre> <p>Now, with the new record type, you can simply write:</p> <pre class="brush:java">record Book (String title, String author) { }</pre> <p>Then the Java compiler will automatically generate appropriate fields, constructor, getter and setter methods. In addition, a record also implements <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">equals()</span>, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">hashCode()</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">toString()</span> methods implicitly.</p> <p>Read the <a href="https://openjdk.java.net/jeps/359" rel="nofollow" target="_blank">JEP 359</a> for more information about Records features.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Pattern matching for instanceof operator (preview):</span></h3> <p>Another new feature was proposed for the Java language is enhancement for the use of <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">instanceof</span> operator. Consider a very familiar use case below:</p> <pre class="brush:java">if (obj instanceof String) { String s = (String) obj; // use s }</pre> <p>Here, the statement that casts the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">obj</span> object to a type of <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">String</span> is somewhat verbose because when the if statement evaluates to true, the type of the object is indeed String. Now with Java 14, we can improve the instanceof statement as follows:</p> <pre class="brush:java">if (obj instanceof String s) { // we use s directly here }</pre> <p>As you can see, it eliminates the verbose cast statement. More advanced, we can add expression to the right like this:</p> <pre class="brush:java">if (obj instanceof String s &amp;&amp; s.length() &gt; 5) { // use String s if its length &gt; 5 }</pre> <p>This would make the use of <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">instanceof</span> operator more flexible and concise. Read the <a href="https://openjdk.java.net/jeps/305" rel="nofollow" target="_blank">JEP 305</a> that covers the greater details of pattern matching for instanceof.</p> <p>Note that the preview features require the switches <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">--enable-preview</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">--source 14</span> when compiling and running. Preview features need further feedback and improvements until they become finalized in future releases of JDK.&nbsp;</p> <p>&nbsp;</p> <h2><a name="ToolsAPI">2. Updates for Tools and APIs in Java 14</a></h2> <p>Another interesting feature in JDK 14 is the introduction of a new packaging tool, among some updates for JDK APIs.</p> <h3><span style="line-height: 107%;">New Packaging Tool (Incubator)</span></h3> <p>JDK 14 shipped with <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jpackage</span> tool that allows programmers to package a Java application into platform-specific package that includes all of the necessary dependencies. This tool will generate installer program for your Java application in native formats: msi and exe on Windows, pkg and dmg on macOS, and deb and rpm on Linux.</p> <p>I’ve experimented this tool for creating a Windows installer for my Java application, using this command:</p> <pre class="brush:text">jpackage --name CodeJavaForm --input dist --main-jar GUIFormExamples.jar --main-class examples.ContactEditor --type msi --win-dir-chooser --win-menu --win-shortcut</pre> <p>And I got a nice installer program that looks like this:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/jpackage_setup_win.png" alt="jpackage setup win" width="420" height="328" /></p> <p>So I think for the first time in history, programmers can create native installer programs for their Java applications with ease. Read the <a href="https://openjdk.java.net/jeps/343" rel="nofollow" target="_blank">JEP 343</a> for more information about packaging tool in JDK 14.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Java IO: Non-Volatile Mapped Byte Buffers</span></h3> <p>This update adds new JDK-specific file mapping modes so that the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';"><span style="color: #800000;">FileChannel</span>&nbsp;</span>API can be used to create <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">MappedByteBuffer</span> instances that refer to non-volatile memory. Check the <a href="https://openjdk.java.net/jeps/352" rel="nofollow" target="_blank">JEP 352</a> for details.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Helpful NullPointerExceptions</span></h3> <p>Perhaps, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">NullPointerException</span> is the most well-known error in Java programming. However, the way which the JVM reports <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">NullPointerException</span> is ambiguous in non-trivial cases. Given two classes A and B as follows:</p> <pre class="brush:java">class A { int i; } class B { int j; } </pre> <p>And a statement that uses object references of A and B like this:</p> <pre class="brush:java">a.i = b.j;</pre> <p>If <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">NullPointerException</span> throws at this line, JVM will terminate with the following error message:&nbsp;</p> <pre class="brush:text">Exception in thread "main" java.lang.NullPointerException at MyProgram.test(MyProgram.java:14) at MyProgram.main(MyProgram.java:6)</pre> <p>It points exactly the line where the exception occurred. But wait, which variable is <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">null</span> in this case, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">a</span> or <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">b</span>??? So programmers have to debug the program or write some checking code to know which <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">a </span>or <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">b</span> is <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">null</span>.</p> <p>The good news is, JDK 14 now computes the null-detail message to help programmers quickly and exactly identify which variable is null. To enable null-detail message, we must specify the following switch when running Java program:</p> <pre class="brush:java">java -XX:+ShowCodeDetailsInExceptionMessages MyProgram</pre> <p>Then JVM will produce more meaningful error message like this:</p> <pre class="brush:text">Exception in thread "main" java.lang.NullPointerException: Cannot assign field "i" because "this.a" is null at MyProgram.test(MyProgram.java:14) at MyProgram.main(MyProgram.java:6)</pre> <p>I think this is a cool feature that saves programmer’s time in debugging their code. Read the <a href="https://openjdk.java.net/jeps/358" rel="nofollow" target="_blank">JEP 358</a> for more details.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Foreign-Memory Access API (Incubator)</span></h3> <p>This feature introduces an API to allow Java programs to safely and efficiently access foreign memory outside of the Java heap. These three interfaces are introduced: <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">MemorySegment</span>, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">MemoryAddress</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">MemoryLayout</span>. Read the <a href="https://openjdk.java.net/jeps/370" rel="nofollow" target="_blank">JEP 370</a> for greater details.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Java Flight Recorder (JFR) Event Streaming</span></h3> <p>For better consumption of data generated by the Java Flight Recorder (JFR), JDK 14 introduces an API that allows Java programs to subscribe to JFR’s data events asynchronously, for continuous monitoring of the Java Virtual Machine. Read the <a href="https://openjdk.java.net/jeps/349" rel="nofollow" target="_blank">JEP 349</a> for more information about this feature.</p> <p>&nbsp;</p> <h2><a name="JVM">3. JVM Performance Improvements in JDK 14</a></h2> <p>JVM performance is continued to be improved in this release. The Garbage First (G1) collector performance is improved by implementing the NUMA-aware memory allocation. NUMA stands for Non-Uniform Memory Access – a modern memory architecture on multi-processor machines.</p> <p>In addition, the Z Garbage Collector (ZGC) is now available for macOS and Windows operating systems - but in experimental phase. ZGC is a scalable low latency garbage collector since JDK 11.</p> <p>&nbsp;</p> <h2><a name="Deprecated">4. What’s Deprecated in JDK 14</a></h2> <p>JDK 14 deprecates the two garbage collection algorithms, namely Parallel Scavenge and Serial Old because they are very little used but requires a significant amount of maintenance effort.</p> <p>JDK 14 also deprecates ports to Solaris/SPARC, Solaris/x64, and Linux/SPARC – which means there will be no JDK builds for Solaris operating system running on SPARC and x64 architecture, and no JDK builds for Linux operating system running on SPARC architecture.</p> <p>&nbsp;</p> <h2><a name="Removed">5. What’s Removed in JDK 14</a></h2> <p>JDK 14 removes the Concurrent <span>Mark Sweep (CMS) garbage collector. CMS has been inten</span>ted to be replaced by G1 <span>since JDK 6. That also allows the JDK development team to focus on ZGC and Shenandoah garbage collectors.</span></p> <p>JDK 14 also removes the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">pack200</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">unpack200</span> tools, and the Pack200 API in the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java.util.jar</span> package. These tools and API were used by developers to compress and uncompress their JAR files – but the major consumer of Pack200 – the JDK itself – no longer needs it.</p> <p>To help you easily understand how to use new language features in Java 14, I've also published the following video. Watch it now:</p> <p>https://www.youtube.com/watch?v=p7pr1-N3oug</p> <p>&nbsp;</p> <h4><span style="line-height: 107%;">References:</span></h4> <ul> <li><a href="https://openjdk.java.net/projects/jdk/14/" rel="nofollow" target="_blank">JDK 14 Project Homepage</a></li> </ul> <p>&nbsp;</p> <h4>You may be also interested in:</h4> <ul> <li><a href="java-se/download-and-install-jdk-14-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 14 (OpenJDK and Oracle JDK)</a></li> <li><a href="java-se/java-15-new-features" target="_blank">What are new features in JDK 15?</a></li> <li><a href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a href="java-core/features-of-the-java-programming-language" target="_blank">Understand 9 features of Java programming language</a></li> <li><a href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div><div class="feed-description"><p>Java 14 was released on March 17<sup>th</sup> 2020 with some interesting new features added to the language – notably the finalization of switch expression enhancements, which leads to addition of the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">yield</span> keyword. Another cool stuff is that, JDK 14 comes with a new packaging tool called <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jpackage</span>– allows programmers to create native installer for Java applications.</p> <p>And like previous Java releases, performance for the Java Virtual Machine (JVM) is continuously improved with several updates for garbage collectors. Among that, something is deprecated for removal in future as well as some other things are actually removed in JDK 14.</p> <p><strong>Table of content:</strong></p> <p style="margin-left: 30px;"><a href="#LanguageFeatures">1. New Language Features in Java 14</a></p> <p style="margin-left: 30px;"><a href="#ToolsAPI">2. Updates for Tools and APIs in Java 14</a></p> <p style="margin-left: 30px;"><a href="#JVM">3. JVM Performance Improvements in JDK 14</a></p> <p style="margin-left: 30px;"><a href="#Deprecated">4. What’s Deprecated in JDK 14</a></p> <p style="margin-left: 30px;"><a href="#Removed">5. What’s Removed in JDK 14</a></p> <p>Now, let’s dive into the details for what’s new, deprecated in removed in Java 14.</p> <p>&nbsp;</p> <h2><a name="LanguageFeatures">1. New Language Features in Java 14</a></h2> <p>Enhancements for switch expressions become standard, whilst Text blocks, Records and Pattern matching for instanceof are still in preview.</p> <h3><span style="line-height: 107%;">Switch Expression Enhancements:</span></h3> <p>The switch-case expression in Java is well-known for its verbosity for multiple-case fall through. Consider the following method:</p> <pre class="brush:java">public void dayOfMonth(int month) { switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println("this month has 31 days"); break; case 2: System.out.println("this month has 28 or 29 days"); break; case 4: case 6: case 9: case 11: System.out.println("this month has 30 days"); break; default: System.out.println("invalid month number"); } }</pre> <p>This is clearly very verbose. Now with Java 14’s enhancements for switch expression, we can rewrite this method as follows:</p> <pre class="brush:java">public static void dayOfMonth(int month) { switch (month) { case 1, 3, 5, 7, 8, 10, 12 -&gt; System.out.println("this month has 31 days"); case 4, 6, 9, 11 -&gt; System.out.println("this month has 30 days"); case 2 -&gt; System.out.println("this month probably has 28 days"); default -&gt; System.out.println("invalid month number"); } }</pre> <p>You see, it’s much clearer and more readable, isn’t it?</p> <p>Moreover, the switch block can return a value to be used in an expression like this:</p> <pre class="brush:java">int days = switch(month) { case 1, 3, 5, 7, 8, 10, 12 -&gt; 31; case 4, 6, 9, 11 -&gt; 30; case 2 -&gt; 28; default -&gt; 0; };</pre> <p>If the code in a case is a block, we can use the yield keyword to return the value, for example:</p> <pre class="brush:java">int days = switch(month) { case 1, 3, 5, 7, 8, 10, 12 -&gt; 31; case 4, 6, 9, 11 -&gt; 30; case 2 -&gt; { System.out.print("Enter year: "); Scanner scanner = new Scanner(System.in); int year = scanner.nextInt(); if (year % 4 == 0) yield 29; else yield 28; } default -&gt; 0; };</pre> <p>So, since Java 14, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">yield</span> becomes the keyword used in switch expression to return a value. Read the JDK Enhancement Proposal <a href="https://openjdk.java.net/jeps/361" rel="nofollow" target="_blank">JEP 361</a> that covers the full detailed of enhancements for switch expression.</p> <p>For more code examples with detailed explanation, read this post&nbsp;<a href="java-core/the-java-language/switch-expression-examples" target="_blank">Java 14: Switch Expressions Enhancements Examples</a>.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Text Blocks (preview):</span></h3> <p>This feature allows programmers to write lengthy String literals in a way that is more readable and effortlessly. Consider the following String literal:</p> <pre class="brush:java">String html = "&lt;html&gt;\n" + " &lt;head&gt;\n" + " &lt;title&gt;Homepage&lt;/title&gt;\n" + " &lt;/head&gt;\n" + " &lt;body&gt;\n" + " &lt;h1&gt;This is the homepage&lt;/h1&gt;\n" + " &lt;/body&gt;\n" + "&lt;/html&gt;\n";</pre> <p>From Java 14, you can rewrite this String literal as follows:</p> <pre class="brush:java">String html = """ &lt;html&gt; &lt;head&gt; &lt;title&gt;Homepage&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;This is the homepage&lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; """;</pre> <p>You see, it looks much more naturally, right? A text bock starts with 3 double quotes follow by a new line character, and ends with 3 double quotes.</p> <p>With text block, you don’t have to escape special characters like new lines or double quotes. Note that the Java compiler will automatically trim the leading spaces in a text block, making it more convenient for programmers.</p> <p>Read the <a href="https://openjdk.java.net/jeps/368" rel="nofollow" target="_blank">JEP 368</a> that describes text block in full details.</p> <p><strong>Update</strong>: Text blocks become a standard feature in JDK 15. Learn more:&nbsp;<a href="java-core/the-java-language/text-blocks-example" target="_blank">Understand Text Blocks Feature in Java 15?</a></p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Records (preview):</span></h3> <p>Records are a new kind of type declaration in the Java language. It simplifies the coding of classes that merely act as “data carrier” i.e. domain classes or POJO classes. Consider the following class:</p> <pre class="brush:java">public class Book { private String title; private String author; public Book(String title, String author) { this.title = title; this.author = author; } public void setTitle(String title) { this.title = title; } public String getTitle() { return this.title; } public void setAuthor(String author) { this.author = author; } public String getAuthor() { return this.author; } } </pre> <p>Now, with the new record type, you can simply write:</p> <pre class="brush:java">record Book (String title, String author) { }</pre> <p>Then the Java compiler will automatically generate appropriate fields, constructor, getter and setter methods. In addition, a record also implements <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">equals()</span>, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">hashCode()</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">toString()</span> methods implicitly.</p> <p>Read the <a href="https://openjdk.java.net/jeps/359" rel="nofollow" target="_blank">JEP 359</a> for more information about Records features.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Pattern matching for instanceof operator (preview):</span></h3> <p>Another new feature was proposed for the Java language is enhancement for the use of <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">instanceof</span> operator. Consider a very familiar use case below:</p> <pre class="brush:java">if (obj instanceof String) { String s = (String) obj; // use s }</pre> <p>Here, the statement that casts the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">obj</span> object to a type of <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">String</span> is somewhat verbose because when the if statement evaluates to true, the type of the object is indeed String. Now with Java 14, we can improve the instanceof statement as follows:</p> <pre class="brush:java">if (obj instanceof String s) { // we use s directly here }</pre> <p>As you can see, it eliminates the verbose cast statement. More advanced, we can add expression to the right like this:</p> <pre class="brush:java">if (obj instanceof String s &amp;&amp; s.length() &gt; 5) { // use String s if its length &gt; 5 }</pre> <p>This would make the use of <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">instanceof</span> operator more flexible and concise. Read the <a href="https://openjdk.java.net/jeps/305" rel="nofollow" target="_blank">JEP 305</a> that covers the greater details of pattern matching for instanceof.</p> <p>Note that the preview features require the switches <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">--enable-preview</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">--source 14</span> when compiling and running. Preview features need further feedback and improvements until they become finalized in future releases of JDK.&nbsp;</p> <p>&nbsp;</p> <h2><a name="ToolsAPI">2. Updates for Tools and APIs in Java 14</a></h2> <p>Another interesting feature in JDK 14 is the introduction of a new packaging tool, among some updates for JDK APIs.</p> <h3><span style="line-height: 107%;">New Packaging Tool (Incubator)</span></h3> <p>JDK 14 shipped with <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">jpackage</span> tool that allows programmers to package a Java application into platform-specific package that includes all of the necessary dependencies. This tool will generate installer program for your Java application in native formats: msi and exe on Windows, pkg and dmg on macOS, and deb and rpm on Linux.</p> <p>I’ve experimented this tool for creating a Windows installer for my Java application, using this command:</p> <pre class="brush:text">jpackage --name CodeJavaForm --input dist --main-jar GUIFormExamples.jar --main-class examples.ContactEditor --type msi --win-dir-chooser --win-menu --win-shortcut</pre> <p>And I got a nice installer program that looks like this:</p> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="images/articles/javase/jpackage_setup_win.png" alt="jpackage setup win" width="420" height="328" /></p> <p>So I think for the first time in history, programmers can create native installer programs for their Java applications with ease. Read the <a href="https://openjdk.java.net/jeps/343" rel="nofollow" target="_blank">JEP 343</a> for more information about packaging tool in JDK 14.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Java IO: Non-Volatile Mapped Byte Buffers</span></h3> <p>This update adds new JDK-specific file mapping modes so that the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';"><span style="color: #800000;">FileChannel</span>&nbsp;</span>API can be used to create <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">MappedByteBuffer</span> instances that refer to non-volatile memory. Check the <a href="https://openjdk.java.net/jeps/352" rel="nofollow" target="_blank">JEP 352</a> for details.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Helpful NullPointerExceptions</span></h3> <p>Perhaps, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">NullPointerException</span> is the most well-known error in Java programming. However, the way which the JVM reports <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">NullPointerException</span> is ambiguous in non-trivial cases. Given two classes A and B as follows:</p> <pre class="brush:java">class A { int i; } class B { int j; } </pre> <p>And a statement that uses object references of A and B like this:</p> <pre class="brush:java">a.i = b.j;</pre> <p>If <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">NullPointerException</span> throws at this line, JVM will terminate with the following error message:&nbsp;</p> <pre class="brush:text">Exception in thread "main" java.lang.NullPointerException at MyProgram.test(MyProgram.java:14) at MyProgram.main(MyProgram.java:6)</pre> <p>It points exactly the line where the exception occurred. But wait, which variable is <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">null</span> in this case, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">a</span> or <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">b</span>??? So programmers have to debug the program or write some checking code to know which <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">a </span>or <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">b</span> is <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">null</span>.</p> <p>The good news is, JDK 14 now computes the null-detail message to help programmers quickly and exactly identify which variable is null. To enable null-detail message, we must specify the following switch when running Java program:</p> <pre class="brush:java">java -XX:+ShowCodeDetailsInExceptionMessages MyProgram</pre> <p>Then JVM will produce more meaningful error message like this:</p> <pre class="brush:text">Exception in thread "main" java.lang.NullPointerException: Cannot assign field "i" because "this.a" is null at MyProgram.test(MyProgram.java:14) at MyProgram.main(MyProgram.java:6)</pre> <p>I think this is a cool feature that saves programmer’s time in debugging their code. Read the <a href="https://openjdk.java.net/jeps/358" rel="nofollow" target="_blank">JEP 358</a> for more details.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Foreign-Memory Access API (Incubator)</span></h3> <p>This feature introduces an API to allow Java programs to safely and efficiently access foreign memory outside of the Java heap. These three interfaces are introduced: <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">MemorySegment</span>, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">MemoryAddress</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">MemoryLayout</span>. Read the <a href="https://openjdk.java.net/jeps/370" rel="nofollow" target="_blank">JEP 370</a> for greater details.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Java Flight Recorder (JFR) Event Streaming</span></h3> <p>For better consumption of data generated by the Java Flight Recorder (JFR), JDK 14 introduces an API that allows Java programs to subscribe to JFR’s data events asynchronously, for continuous monitoring of the Java Virtual Machine. Read the <a href="https://openjdk.java.net/jeps/349" rel="nofollow" target="_blank">JEP 349</a> for more information about this feature.</p> <p>&nbsp;</p> <h2><a name="JVM">3. JVM Performance Improvements in JDK 14</a></h2> <p>JVM performance is continued to be improved in this release. The Garbage First (G1) collector performance is improved by implementing the NUMA-aware memory allocation. NUMA stands for Non-Uniform Memory Access – a modern memory architecture on multi-processor machines.</p> <p>In addition, the Z Garbage Collector (ZGC) is now available for macOS and Windows operating systems - but in experimental phase. ZGC is a scalable low latency garbage collector since JDK 11.</p> <p>&nbsp;</p> <h2><a name="Deprecated">4. What’s Deprecated in JDK 14</a></h2> <p>JDK 14 deprecates the two garbage collection algorithms, namely Parallel Scavenge and Serial Old because they are very little used but requires a significant amount of maintenance effort.</p> <p>JDK 14 also deprecates ports to Solaris/SPARC, Solaris/x64, and Linux/SPARC – which means there will be no JDK builds for Solaris operating system running on SPARC and x64 architecture, and no JDK builds for Linux operating system running on SPARC architecture.</p> <p>&nbsp;</p> <h2><a name="Removed">5. What’s Removed in JDK 14</a></h2> <p>JDK 14 removes the Concurrent <span>Mark Sweep (CMS) garbage collector. CMS has been inten</span>ted to be replaced by G1 <span>since JDK 6. That also allows the JDK development team to focus on ZGC and Shenandoah garbage collectors.</span></p> <p>JDK 14 also removes the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">pack200</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">unpack200</span> tools, and the Pack200 API in the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">java.util.jar</span> package. These tools and API were used by developers to compress and uncompress their JAR files – but the major consumer of Pack200 – the JDK itself – no longer needs it.</p> <p>To help you easily understand how to use new language features in Java 14, I've also published the following video. Watch it now:</p> <p>https://www.youtube.com/watch?v=p7pr1-N3oug</p> <p>&nbsp;</p> <h4><span style="line-height: 107%;">References:</span></h4> <ul> <li><a href="https://openjdk.java.net/projects/jdk/14/" rel="nofollow" target="_blank">JDK 14 Project Homepage</a></li> </ul> <p>&nbsp;</p> <h4>You may be also interested in:</h4> <ul> <li><a href="java-se/download-and-install-jdk-14-openjdk-and-oracle-jdk" target="_blank">Download and Install JDK 14 (OpenJDK and Oracle JDK)</a></li> <li><a href="java-se/java-15-new-features" target="_blank">What are new features in JDK 15?</a></li> <li><a href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a href="java-core/features-of-the-java-programming-language" target="_blank">Understand 9 features of Java programming language</a></li> <li><a href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul></div>What are New Features in JDK 15?2020-10-11T07:44:15-05:002020-10-11T07:44:15-05:00https://www.codejava.net/java-se/java-15-new-featuresNam Ha Minhhainatu@gmail.com<div class="feed-description"><p>JDK 15 has been released to the public Java developer community since September 15<sup>th</sup> 2020, as of 6-month release cadence. In this article, I would like to share with you some new features in Java 15 that are most important to developers.</p> <p>&nbsp;</p> <h2>1. Sealed Classes and Interfaces (preview)</h2> <p>This language feature allows programmers to specify exactly known subtypes of a class or interface. In other words, restrict the extension of a superclass to only some known subclasses – prevent arbitrary (unknown) subclasses. Let’s take an example as below:</p> <pre class="brush:java">public sealed class Shape permits Rectangle, Circle, Triangle { }</pre> <p>Here, the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';"><span style="color: #800000;">Shape</span>&nbsp;</span>class permits exactly only 3 subclasses that are <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Rectangle</span>, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Circle</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Triangle</span>. These subclasses are known at compile time, and no other classes can extend the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Shape</span> class.</p> <p>And a subclass of a sealed class should be declared either final, sealed or non-sealed. For example, the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Rectangle</span> class is declared as follows:</p> <pre class="brush:java">public final class Rectangle extends Shape { }</pre> <p>Here, no classes can extend the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Rectangle</span> class because it is declared as final.</p> <p>And the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Circle</span> class is declared as follows:</p> <pre class="brush:java">public sealed class Circle extends Shape permits Sphere { }</pre> <p>This means the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Circle</span> class is sealed and it permits <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Sphere</span> as the only one subclass.</p> <p>And the&nbsp;<span style="font-size: 10pt; line-height: 14.2667px; font-family: 'Courier New'; color: #800000;">Triangle</span> class is declared as below:</p> <pre class="brush:java">public non-sealed class Triangle extends Shape { }</pre> <p>Here, the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Triangle</span> class is non-sealed, which means it opens extension for any unknown classes.</p> <p>The similar rules applied for sealed interfaces. This feature will introduce 3 potential new keywords for the Java language: sealed, permits and non-sealed. Sealed classes and interfaces are still in preview mode in Java 15, which requires further feedback from developer community before it becomes a standard feature in future release of Java.</p> <p>For greater details of sealed classes, you can read <a href="https://openjdk.java.net/jeps/360" rel="nofollow" target="_blank">JEP 360</a> on java.net.</p> <p>&nbsp;</p> <h2>2. Hidden Classes</h2> <p>Java 15 introduces <i>hidden classes</i>, which are classes that cannot be used directly by other classes. Hidden classes are intended for use by frameworks that generate classes at run time and use them indirectly via reflection.</p> <p>If you use frameworks like Spring and Hibernate, you probably know that they generate lots of dynamic classes at run time. For example, Hibernate generates dynamic classes as proxies of entity classes and Spring generates dynamic classes for transaction management and repositories implementations.</p> <p>I think the main motivation behind hidden classes is to generate short-live dynamic classes which can be unloaded completely from JVM when they are no longer used – avoid unnecessary increased memory footprint.</p> <p>Study <a href="https://openjdk.java.net/jeps/371" rel="nofollow" target="_blank">JEP 371</a> for detailed specification of hidden classes.</p> <p>&nbsp;</p> <h2>3. Pattern matching for instanceof (second preview)</h2> <p>This feature was introduced in JDK 14 and it is still under review in JDK 15. In Java, programmers are used to use the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';"><span style="color: #800000;">instanceof</span>&nbsp;</span>operator in a very verbose way:</p> <pre class="brush:java">if (obj instanceof String) { String s = (String) obj; // use s }</pre> <p>The statement that casts the object <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">obj</span> to the variable <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">s </span>of type String is unnecessarily verbose. But now, programmers don’t have to write that statement anymore, like this:</p> <pre class="brush:java">if (obj instanceof String s) { // s can be used directly here }</pre> <p>Furthermore, we can add expressions to the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">instanceof</span> operator as shown below:</p> <pre class="brush:java">if (obj instanceof String s &amp;&amp; s.length() &gt; 10) { // use String s if its length &gt; 10 }</pre> <p>So I think this feature will make the use of <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">instanceof</span> operator easier, more flexible and more powerful. And hope it will become standard feature in Java 16. For details, you can read the <a href="https://openjdk.java.net/jeps/375" target="_blank">JEP 375</a> page.</p> <p>&nbsp;</p> <h2>4. Text Blocks (Standard)</h2> <p>Another frustrating issue when writing Java code is the declaration of String literals that span on multiple lines. Let’s take a classic example:</p> <pre class="brush:java">@Query("SELECT p FROM Product p WHERE p.name LIKE %?1% " + "OR p.shortDescription LIKE %?1% " + "OR p.fullDescription LIKE %?1% " + "OR p.brand.name LIKE %?1% " + "OR p.category.name LIKE %?1%") public Page&lt;Product&gt; findAll(String keyword, Pageable pageable);</pre> <p>Though IDEs can help writing multi-line String literals easily, the concatenation operators and escape sequences make the String difficult to read and also maintenance is cumbersome.</p> <p>Feel the pain of developers, Java 15 finally supports text blocks feature that allows programmers to write multi-line String literals much easier – almost avoid the need of concatenation and escape sequences. The above code can be rewritten using text blocks as shown below:</p> <pre class="brush:java">@Query(""" SELECT p FROM Product p WHERE p.name LIKE %?1% \ OR p.shortDescription LIKE %?1% \ OR p.fullDescription LIKE %?1% \ OR p.brand.name LIKE %?1% \ OR p.category.name LIKE %?1% """) public Page&lt;Product&gt; findAll(String keyword, Pageable pageable);</pre> <p>Note that the backward slash character (\) tells Java compiler to continue the String literal on the next line (hence not inserting new line characters).</p> <p>So I think this is the most useful feature in Java 15. We now can embed SQL, HTML, JSON, XML, etc in Java code easily and avoid the maintenance headache.</p> <p>Read <a href="java-core/the-java-language/text-blocks-example" target="_blank">this article</a> to understand how to use text blocks in depth.</p> <p>&nbsp;</p> <h2>5. Record (second preview)</h2> <p>Java is also very well-known for its verbosity when it comes to “data carrier” classes (e.g. domain model/entity/POJO). Let’s take a classic entity class written in Java:</p> <pre class="brush:java">public class Product { private Integer id; private String name; private float price; public Product() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public float getPrice() { return price; } public void setPrice(float price) { this.price = price; } @Override public int hashCode() { // ... } @Override public boolean equals(Object obj) { // ... } @Override public String toString() { // ... } }</pre> <p>As you can see, the field’s getters and setters, and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">equals()</span>, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">hashCode()</span>, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">toString()</span> methods are cumbersome and it will be frustrating when the fields and entity classes growing.</p> <p>Now with the record feature, the above lengthy class can be declared as simple as below:</p> <pre class="brush:java">record Product (Integer id, String name, float price) { }</pre> <p>I think this feature will be very helpful for developers. However, it is still under review (second preview) in Java 15, and it may become standard feature in Java 16.</p> <p>Besides the new features above, JDK 15 also includes the following updates, for your reference:</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Edwards-Curve Digital Signature Algorithm (EdDSA)</span></h3> <p>EdDSA is a modern cryptography algorithm which provides improved security and performance compared to other algorithms. JDK 15 implements EdDSA into its crypto API, so programmers can use EdDSA without having to use a third-party library.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Reimplement the Legacy DatagramSocket API</span></h3> <p>The DatagramSocket API was implemented in the early days of JDK when IPv6 was still under development so it has several issues. That’s why JDK 15 replaces the underlying implementation of this API with simpler and more modern implementations that are easy to maintain and debug.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Foreign-Memory Access API (Second Incubator)</span></h3> <p>This API was first introduce in JDK 14 and is still in incubator in JDK 15. It aims at providing an API that allows programmers to safely and efficiently access the memory area that is outside of Java heap.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Remove the Nashorn JavaScript Engine</span></h3> <p>JDK 15 finally dropped Nashorn – a Javascript engine running on JVM. That means developer is no longer able to write and run Javascript on JDK 15 and future releases. The suggested alternative is GraalVM which supports latest Javascript specification and provides better performance.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Deprecate RMI Activation for Removal</span></h3> <p>RMI is a very old technology which could be used in the early days of Internet and World Wide Web. Today, RMI is no longer suitable and almost dead so it’s naturally to be removed from JDK.</p> <p>And as usual, new JDK release always includes performance improvements for Java Virtual Machine and garbage collector. For the complete list of features in JDK 15 with full detailed description, I recommend you to visit the <a href="https://openjdk.java.net/projects/jdk/15/" rel="nofollow" target="_blank">OpenJDK 15</a> project page.</p> <p>To see the code of new features in Java 15 in action, watch the video below:</p> <p>https://www.youtube.com/watch?v=dmeLQBoxNFA</p> <p>&nbsp;</p> <h4 style="font-family: 'Open Sans', sans-serif; color: #333333;">You may be also interested in:</h4> <ul style="font-size: 14.3px;"> <li><a style="cursor: pointer;" href="java-se/download-and-install-openjdk-15" target="_blank">Download and Install OpenJDK 15</a></li> <li><a href="java-se/java-14-new-features" target="_blank">What are new features in Java 14?</a></li> <li><a style="cursor: pointer;" href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a style="cursor: pointer;" href="java-core/features-of-the-java-programming-language" target="_blank">Understand 9 features of Java programming language</a></li> <li><a style="cursor: pointer;" href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul> <p>&nbsp;</p></div><div class="feed-description"><p>JDK 15 has been released to the public Java developer community since September 15<sup>th</sup> 2020, as of 6-month release cadence. In this article, I would like to share with you some new features in Java 15 that are most important to developers.</p> <p>&nbsp;</p> <h2>1. Sealed Classes and Interfaces (preview)</h2> <p>This language feature allows programmers to specify exactly known subtypes of a class or interface. In other words, restrict the extension of a superclass to only some known subclasses – prevent arbitrary (unknown) subclasses. Let’s take an example as below:</p> <pre class="brush:java">public sealed class Shape permits Rectangle, Circle, Triangle { }</pre> <p>Here, the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';"><span style="color: #800000;">Shape</span>&nbsp;</span>class permits exactly only 3 subclasses that are <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Rectangle</span>, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Circle</span> and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Triangle</span>. These subclasses are known at compile time, and no other classes can extend the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Shape</span> class.</p> <p>And a subclass of a sealed class should be declared either final, sealed or non-sealed. For example, the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Rectangle</span> class is declared as follows:</p> <pre class="brush:java">public final class Rectangle extends Shape { }</pre> <p>Here, no classes can extend the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Rectangle</span> class because it is declared as final.</p> <p>And the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Circle</span> class is declared as follows:</p> <pre class="brush:java">public sealed class Circle extends Shape permits Sphere { }</pre> <p>This means the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Circle</span> class is sealed and it permits <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Sphere</span> as the only one subclass.</p> <p>And the&nbsp;<span style="font-size: 10pt; line-height: 14.2667px; font-family: 'Courier New'; color: #800000;">Triangle</span> class is declared as below:</p> <pre class="brush:java">public non-sealed class Triangle extends Shape { }</pre> <p>Here, the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">Triangle</span> class is non-sealed, which means it opens extension for any unknown classes.</p> <p>The similar rules applied for sealed interfaces. This feature will introduce 3 potential new keywords for the Java language: sealed, permits and non-sealed. Sealed classes and interfaces are still in preview mode in Java 15, which requires further feedback from developer community before it becomes a standard feature in future release of Java.</p> <p>For greater details of sealed classes, you can read <a href="https://openjdk.java.net/jeps/360" rel="nofollow" target="_blank">JEP 360</a> on java.net.</p> <p>&nbsp;</p> <h2>2. Hidden Classes</h2> <p>Java 15 introduces <i>hidden classes</i>, which are classes that cannot be used directly by other classes. Hidden classes are intended for use by frameworks that generate classes at run time and use them indirectly via reflection.</p> <p>If you use frameworks like Spring and Hibernate, you probably know that they generate lots of dynamic classes at run time. For example, Hibernate generates dynamic classes as proxies of entity classes and Spring generates dynamic classes for transaction management and repositories implementations.</p> <p>I think the main motivation behind hidden classes is to generate short-live dynamic classes which can be unloaded completely from JVM when they are no longer used – avoid unnecessary increased memory footprint.</p> <p>Study <a href="https://openjdk.java.net/jeps/371" rel="nofollow" target="_blank">JEP 371</a> for detailed specification of hidden classes.</p> <p>&nbsp;</p> <h2>3. Pattern matching for instanceof (second preview)</h2> <p>This feature was introduced in JDK 14 and it is still under review in JDK 15. In Java, programmers are used to use the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New';"><span style="color: #800000;">instanceof</span>&nbsp;</span>operator in a very verbose way:</p> <pre class="brush:java">if (obj instanceof String) { String s = (String) obj; // use s }</pre> <p>The statement that casts the object <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">obj</span> to the variable <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">s </span>of type String is unnecessarily verbose. But now, programmers don’t have to write that statement anymore, like this:</p> <pre class="brush:java">if (obj instanceof String s) { // s can be used directly here }</pre> <p>Furthermore, we can add expressions to the <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">instanceof</span> operator as shown below:</p> <pre class="brush:java">if (obj instanceof String s &amp;&amp; s.length() &gt; 10) { // use String s if its length &gt; 10 }</pre> <p>So I think this feature will make the use of <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">instanceof</span> operator easier, more flexible and more powerful. And hope it will become standard feature in Java 16. For details, you can read the <a href="https://openjdk.java.net/jeps/375" target="_blank">JEP 375</a> page.</p> <p>&nbsp;</p> <h2>4. Text Blocks (Standard)</h2> <p>Another frustrating issue when writing Java code is the declaration of String literals that span on multiple lines. Let’s take a classic example:</p> <pre class="brush:java">@Query("SELECT p FROM Product p WHERE p.name LIKE %?1% " + "OR p.shortDescription LIKE %?1% " + "OR p.fullDescription LIKE %?1% " + "OR p.brand.name LIKE %?1% " + "OR p.category.name LIKE %?1%") public Page&lt;Product&gt; findAll(String keyword, Pageable pageable);</pre> <p>Though IDEs can help writing multi-line String literals easily, the concatenation operators and escape sequences make the String difficult to read and also maintenance is cumbersome.</p> <p>Feel the pain of developers, Java 15 finally supports text blocks feature that allows programmers to write multi-line String literals much easier – almost avoid the need of concatenation and escape sequences. The above code can be rewritten using text blocks as shown below:</p> <pre class="brush:java">@Query(""" SELECT p FROM Product p WHERE p.name LIKE %?1% \ OR p.shortDescription LIKE %?1% \ OR p.fullDescription LIKE %?1% \ OR p.brand.name LIKE %?1% \ OR p.category.name LIKE %?1% """) public Page&lt;Product&gt; findAll(String keyword, Pageable pageable);</pre> <p>Note that the backward slash character (\) tells Java compiler to continue the String literal on the next line (hence not inserting new line characters).</p> <p>So I think this is the most useful feature in Java 15. We now can embed SQL, HTML, JSON, XML, etc in Java code easily and avoid the maintenance headache.</p> <p>Read <a href="java-core/the-java-language/text-blocks-example" target="_blank">this article</a> to understand how to use text blocks in depth.</p> <p>&nbsp;</p> <h2>5. Record (second preview)</h2> <p>Java is also very well-known for its verbosity when it comes to “data carrier” classes (e.g. domain model/entity/POJO). Let’s take a classic entity class written in Java:</p> <pre class="brush:java">public class Product { private Integer id; private String name; private float price; public Product() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public float getPrice() { return price; } public void setPrice(float price) { this.price = price; } @Override public int hashCode() { // ... } @Override public boolean equals(Object obj) { // ... } @Override public String toString() { // ... } }</pre> <p>As you can see, the field’s getters and setters, and <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">equals()</span>, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">hashCode()</span>, <span style="font-size: 10pt; line-height: 107%; font-family: 'Courier New'; color: #800000;">toString()</span> methods are cumbersome and it will be frustrating when the fields and entity classes growing.</p> <p>Now with the record feature, the above lengthy class can be declared as simple as below:</p> <pre class="brush:java">record Product (Integer id, String name, float price) { }</pre> <p>I think this feature will be very helpful for developers. However, it is still under review (second preview) in Java 15, and it may become standard feature in Java 16.</p> <p>Besides the new features above, JDK 15 also includes the following updates, for your reference:</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Edwards-Curve Digital Signature Algorithm (EdDSA)</span></h3> <p>EdDSA is a modern cryptography algorithm which provides improved security and performance compared to other algorithms. JDK 15 implements EdDSA into its crypto API, so programmers can use EdDSA without having to use a third-party library.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Reimplement the Legacy DatagramSocket API</span></h3> <p>The DatagramSocket API was implemented in the early days of JDK when IPv6 was still under development so it has several issues. That’s why JDK 15 replaces the underlying implementation of this API with simpler and more modern implementations that are easy to maintain and debug.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Foreign-Memory Access API (Second Incubator)</span></h3> <p>This API was first introduce in JDK 14 and is still in incubator in JDK 15. It aims at providing an API that allows programmers to safely and efficiently access the memory area that is outside of Java heap.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Remove the Nashorn JavaScript Engine</span></h3> <p>JDK 15 finally dropped Nashorn – a Javascript engine running on JVM. That means developer is no longer able to write and run Javascript on JDK 15 and future releases. The suggested alternative is GraalVM which supports latest Javascript specification and provides better performance.</p> <p>&nbsp;</p> <h3><span style="line-height: 107%;">Deprecate RMI Activation for Removal</span></h3> <p>RMI is a very old technology which could be used in the early days of Internet and World Wide Web. Today, RMI is no longer suitable and almost dead so it’s naturally to be removed from JDK.</p> <p>And as usual, new JDK release always includes performance improvements for Java Virtual Machine and garbage collector. For the complete list of features in JDK 15 with full detailed description, I recommend you to visit the <a href="https://openjdk.java.net/projects/jdk/15/" rel="nofollow" target="_blank">OpenJDK 15</a> project page.</p> <p>To see the code of new features in Java 15 in action, watch the video below:</p> <p>https://www.youtube.com/watch?v=dmeLQBoxNFA</p> <p>&nbsp;</p> <h4 style="font-family: 'Open Sans', sans-serif; color: #333333;">You may be also interested in:</h4> <ul style="font-size: 14.3px;"> <li><a style="cursor: pointer;" href="java-se/download-and-install-openjdk-15" target="_blank">Download and Install OpenJDK 15</a></li> <li><a href="java-se/java-14-new-features" target="_blank">What are new features in Java 14?</a></li> <li><a style="cursor: pointer;" href="java-se/java-se-versions-history" target="_blank">Java SE versions history</a></li> <li><a style="cursor: pointer;" href="java-core/features-of-the-java-programming-language" target="_blank">Understand 9 features of Java programming language</a></li> <li><a style="cursor: pointer;" href="java-core/what-are-jvm-jre-and-jdk" target="_blank">What are JVM, JRE and JDK</a></li> </ul> <p>&nbsp;</p></div>