{"id":5932,"date":"2021-09-28T10:51:37","date_gmt":"2021-09-28T14:51:37","guid":{"rendered":"https:\/\/www.dr-chuck.com\/csev-blog\/?p=5932"},"modified":"2021-09-28T10:51:37","modified_gmt":"2021-09-28T14:51:37","slug":"sakai-22-moving-to-java-11","status":"publish","type":"post","link":"https:\/\/www.dr-chuck.com\/csev-blog\/2021\/09\/sakai-22-moving-to-java-11\/","title":{"rendered":"Sakai 22 moving to Java 11"},"content":{"rendered":"<p>(This was originally from Earle Neitzel on the Sakai dev-list)<\/p>\n<div class=\"user-content-block\">\n<p>The time has finally come for Sakai to adopt and move to Java 11.<\/p>\n<p>A big part of this decision is inline with the libraries that Sakai uses, once all the significant libraries have transitioned to running in a newer JDK Sakai itself becomes eligible\u00a0for the same. Sakai software (like most software) is like lego&#8217;s and the blocks all need to have the same shape and size in order to work together. So once all the fundamental blocks (like spring, hibernate, elasticsearch, ignite, server side UI frameworks) support a newer JDK, then Sakai can look at adopting that JDK.<\/p>\n<p><b>History<\/b><br \/>\nJDK 5 Dec 14 2006 (approx)<br \/>\nJDK 6 Feb 20 2012 <a class=\"issue-link\" title=\"Upgrade Java version to JDK 7.x\" href=\"https:\/\/jira.sakaiproject.org\/browse\/SAK-20908\" data-issue-key=\"SAK-20908\"><del>SAK-20908<\/del><\/a><br \/>\nJDK 7 Oct 27 2014 <a class=\"issue-link\" title=\"Make Java 7 the default language syntax and minimum build version\" href=\"https:\/\/jira.sakaiproject.org\/browse\/SAK-28016\" data-issue-key=\"SAK-28016\"><del>SAK-28016<\/del><\/a><br \/>\nJDK 8 March 29, 2015 <a class=\"issue-link\" title=\"Upgrade Java to JDK 8\" href=\"https:\/\/jira.sakaiproject.org\/browse\/SAK-25903\" data-issue-key=\"SAK-25903\"><del>SAK-25903<\/del><\/a><br \/>\nJDK 11 Sept 24 2021 <a class=\"issue-link\" title=\"Support Java 11\" href=\"https:\/\/jira.sakaiproject.org\/browse\/SAK-33595\" data-issue-key=\"SAK-33595\"><del>SAK-33595<\/del><\/a><\/p>\n<p>In the past, it was customary\u00a0to limit newer language syntax in order to preserve compatibility when merging changes to previous versions. I propose we do this for at least 1 Sakai version which would mean once the 23 branch is cut then we could allow newer syntax. I would also revisit this at that time to see if it should be extended to 2 Sakai versions. (Most IDE&#8217;s will allow you to set the syntax level to help prevent you from using newer syntax)<\/p>\n<p><b>Jakarta package name<\/b><br \/>\nSo in conjunction upgrading to jdk 11, jdk 9+ removed much of the javax namespace (aka JEE) it means that many of these packages are now separate libs which need to be included. On top of that Oracle has given the Java EE to Eclipse with the restriction that they cannot use the word &#8220;Java&#8221; hence the need to rename the packages to Jakarta. Given many of our libs are still using the javax package names we can use jakarta libs that keep the package name space (like activation\u00a0and validation) but newer jakarta packages are changing the package names as well this last part is causing some issues as some of the\u00a0libs are still on versions using the javax package name. I propose that until Sakai is on newer libs that support the newer package names that we stay on the javax namespace. This means that i reverted a recent contribution\u00a0<a class=\"issue-link\" title=\"Update javax.mail 2.0.1\" href=\"https:\/\/jira.sakaiproject.org\/browse\/SAK-45950\" data-issue-key=\"SAK-45950\">SAK-45950<\/a> by David Horrowitz to stay on the javax package name, I apologize but believe it&#8217;s the right thing to do at this time.<\/p>\n<p><b>Building Sakai with JDK 11<\/b><br \/>\nThe source can only be built using JDK 11 moving forward. So you will need to download and use a respective JDK. I propose that Sakai standardize on the OpenJDK project as all other projects use that project as a base and should ensure our compatibility with other JDK flavors.<\/p>\n<p>This project\u00a0<a class=\"external-link\" title=\"Follow link\" href=\"https:\/\/sdkman.io\/\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/sdkman.io\/<\/a>\u00a0makes that task simple.<\/p>\n<p><b>Running Sakai with JDK 11<\/b><br \/>\nHere will list the options we will need to use to run Sakai in JDK 11.<br \/>\nIn your setenv.(sh|bat) you will need to add the following lines to JAVA_OPTS or CATALINA_OPTS:<br \/>\n&#8211;add-exports=java.base\/jdk.internal.misc=ALL-UNNAMED \\<br \/>\n&#8211;add-exports=java.base\/<a class=\"external-link\" title=\"Follow link\" href=\"http:\/\/sun.nio.ch\/\" target=\"_blank\" rel=\"nofollow noopener\">sun.nio.ch<\/a>=ALL-UNNAMED \\<br \/>\n&#8211;add-exports=java.management\/com.sun.jmx.mbeanserver=ALL-UNNAMED \\<br \/>\n&#8211;add-exports=jdk.internal.jvmstat\/sun.jvmstat.monitor=ALL-UNNAMED \\<br \/>\n&#8211;add-exports=java.base\/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED \\<br \/>\n&#8211;add-opens jdk.management\/com.sun.management.internal=ALL-UNNAMED \\<br \/>\n&#8211;illegal-access=permit<\/p>\n<p>Next you will want to select a Garbage Collector to use this may depend on the JDK that your using. See the following page for some info\u00a0<a class=\"external-link\" title=\"Follow link\" href=\"https:\/\/docs.oracle.com\/en\/java\/javase\/11\/gctuning\/available-collectors.html\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/docs.oracle.com\/en\/java\/javase\/11\/gctuning\/available-collectors.html<\/a>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(This was originally from Earle Neitzel on the Sakai dev-list) The time has finally come for Sakai to adopt and move to Java 11. A big part of this decision is inline with the libraries that Sakai uses, once all the significant libraries have transitioned to running in a newer JDK Sakai itself becomes eligible\u00a0for [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5932","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/5932","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/comments?post=5932"}],"version-history":[{"count":2,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/5932\/revisions"}],"predecessor-version":[{"id":5934,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/5932\/revisions\/5934"}],"wp:attachment":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/media?parent=5932"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/categories?post=5932"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/tags?post=5932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}