{"id":370286,"date":"2024-05-21T04:21:45","date_gmt":"2024-05-21T04:21:45","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=370286"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=370286","title":{"rendered":"<span>\u0421\u0438\u0441\u0442\u0435\u043c\u0443 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0432 Java \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/749\/61c\/992\/74961c992df099fa0b322b5277995613.png\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/749\/61c\/992\/74961c992df099fa0b322b5277995613.png\"\/><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p><strong>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439<\/strong> \u0432\u00a0Java 9, \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043a\u0430\u043a <em>Project Jigsaw<\/em>,\u00a0\u0431\u044b\u043b\u0430 \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u0430 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0434\u043b\u044f\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0440\u044f\u0434\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u00ab<a href=\"https:\/\/dzone.com\/articles\/what-is-jar-hell\">\u0410\u0434 JAR\u2011\u0444\u0430\u0439\u043b\u043e\u0432<\/a>\u00bb \u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0441\u00a0\u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p>\u0418 \u0432\u043e\u0442 \u0441 <a href=\"https:\/\/www.oracle.com\/java\/java9\/\">Java 9<\/a> <strong>\u043c\u043e\u0436\u043d\u043e \u044f\u0432\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/strong>, \u043a\u0430\u043a\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 <strong>\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432\u043d\u0435\u0448\u043d\u0435\u043c\u0443<\/strong> \u043c\u0438\u0440\u0443, \u0430\u00a0\u043a\u0430\u043a\u0438\u0435 <strong>\u0441\u043a\u0440\u044b\u0442\u044b \u0438 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u044b<\/strong> \u043e\u0442\u00a0\u043d\u0435\u0441\u0430\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430. <\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u043d\u043e\u0441\u0438\u0442 <em>\u044f\u0441\u043d\u043e\u0441\u0442\u044c <\/em>\u0438 <em>\u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/em> \u0432\u00a0\u0442\u043e, \u043a\u0430\u043a\u00a0\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u00a0\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438 \u0438 \u0434\u0440\u0443\u0433 \u0441\u00a0\u0434\u0440\u0443\u0433\u043e\u043c. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u044f\u0432\u043d\u044b\u043c\u0438 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c\u0438.<\/p>\n<p><em>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u00a0\u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u00a0\u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0432\u00a0Java.<\/em><\/p>\n<h4>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438 \u0442\u0438\u043f\u044b \u043c\u043e\u0434\u0443\u043b\u0435\u0439   <\/h4>\n<p><strong>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438<\/strong> \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 <a href=\"https:\/\/www.oracle.com\/de\/java\/technologies\/java-se-glance.html\">Java SE<\/a> \u0438 JDE, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 Java\u2011\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>java --list-modules<\/code>, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0438\u0445 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e! \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u00a0\u043d\u0438\u0445:<\/p>\n<pre><code class=\"bash\">java.activation java.base java.compiler java.corba java.datatransfer java.desktop java.instrument java.jnlp java.logging java.management java.management.rmi java.naming java.prefs java.rmi java.scripting java.se java.se.ee java.security.jgss java.security.sasl java.smartcardio java.sql java.sql.rowset<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438<\/strong> &#8212; \u0431\u043b\u043e\u043a\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. <\/p>\n<p><strong>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438<\/strong>, \u2014 \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 JAR-\u0444\u0430\u0439\u043b\u044b \u043a\u0430\u043a \u043c\u043e\u0434\u0443\u043b\u0438, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043d\u0435 \u0431\u044b\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c JAR-\u0444\u0430\u0439\u043b \u043d\u0430 <code>--module-path<\/code>, \u0438 Java \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044c, \u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043e \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 JAR-\u0444\u0430\u0439\u043b\u0430.<\/p>\n<p><strong>\u0411\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438,<\/strong> \u2014 \u044d\u0442\u043e \u0441\u043f\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u0440\u0443\u0433 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u043d\u0430 <code>module-path<\/code>. \u0412\u0441\u0435 JAR-\u0444\u0430\u0439\u043b\u044b, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 <code>--class-path<\/code>, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0431\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u0432\u0441\u0451 \u0432\u0440\u0430\u0449\u0430\u043b\u043e\u0441\u044c \u0432\u043e\u043a\u0440\u0443\u0433 <code>class-path<\/code> \u2014 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 JVM \u0438\u0441\u043a\u0430\u043b\u0430 \u0432\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c <code>module-path<\/code> \u043c\u0430\u0441\u0442\u0445\u0435\u0432 \u0438 \u044e\u0437\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0437\u0434\u0435, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0440\u043e\u0433\u043e\u0435 \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/p>\n<h3>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f  <\/h3>\n<p><strong>\u041c\u043e\u0434\u0443\u043b\u044c \u0432 Java<\/strong> \u2014 \u044d\u0442\u043e <em>\u0441\u0430\u043c\u043e\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0439<\/em>, <em>\u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043f\u0430\u043a\u0435\u0442<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u0434 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 <strong>\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u0432\u043e\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/strong><\/p>\n<p>\u0424\u0430\u0439\u043b <code>module-info.java<\/code> &#8212; <em>\u0446\u0435\u043d\u0442\u0440 \u043c\u043e\u0434\u0443\u043b\u0435\u0439<\/em> \u0432 Java. \u041e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c, \u0435\u0433\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0443\u0441\u043b\u0443\u0433\u0438. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u2014 \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043c\u043e\u0434\u0443\u043b\u044f:<\/p>\n<pre><code class=\"java\">module com.example.myModule {     requires java.sql;     exports com.example.myModule.api;     uses com.example.myModule.spi.MyService;     provides com.example.myModule.spi.MyService with com.example.myModule.internal.MyServiceImpl; }<\/code><\/pre>\n<p><code>requires<\/code>: \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>requires java.sql;<\/code> \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <code>java.sql<\/code> \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p><code>exports<\/code>: \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0443\u043b\u0443\u0447\u0448\u0430\u044f \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044e. <code>exports com.example.myModule.api;<\/code> \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u0430\u043a\u0435\u0442, \u0434\u0435\u043b\u0430\u044f \u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043d\u0435 \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<p><code>uses<\/code>: \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441. \u041c\u043e\u0434\u0443\u043b\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441, \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u043d\u0430\u044e\u0442 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. \u041f\u0440\u0438\u043c\u0435\u0440: <\/p>\n<pre><code class=\"java\">uses com.example.myModule.spi.MyService;<\/code><\/pre>\n<p><code>provides ... with<\/code>: \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. <code>provides com.example.myModule.spi.MyService with com.example.myModule.internal.MyServiceImpl;<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e <code>MyServiceImpl<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 <code>MyService<\/code>.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c <code>com.example.data<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0440\u044f\u0434 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 API \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u044b:<\/p>\n<pre><code class=\"java\">module com.example.data {     requires java.logging;     requires transitive com.example.utils;     exports com.example.data.api;     uses com.example.data.spi.DataService;     provides com.example.data.spi.DataService with com.example.data.internal.DataServiceImpl; }<\/code><\/pre>\n<p>\u0414\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 <code>requires transitive com.example.utils;<\/code> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u0439 \u043e\u0442 <code>com.example.data<\/code>, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a <code>com.example.utils<\/code>.<\/p>\n<h3>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0443\u0441\u043b\u0443\u0433<\/h3>\n<p>\u0423\u0441\u043b\u0443\u0433\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438\u043b\u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0443\u0441\u043b\u0443\u0433\u0438 &#8212; \u044d\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043b\u0438 \u043e\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f. \u0414\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0441\u043b\u0443\u0433\u0438 \u0438 \u0435\u0451 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b <code>uses<\/code> \u0438 <code>provides ... with<\/code> \u0432 \u0444\u0430\u0439\u043b\u0435 <code>module-info.java<\/code>.<\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0435\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>ServiceInterface<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0441\u043b\u0443\u0433\u0443, \u0438 \u043a\u043b\u0430\u0441\u0441 <code>ServiceImpl<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u043e\u0439 \u0443\u0441\u043b\u0443\u0433\u0438:<\/p>\n<pre><code class=\"java\">package com.example.service;  public interface ServiceInterface {     void execute(); }<\/code><\/pre>\n<pre><code class=\"java\">package com.example.service.impl;  import com.example.service.ServiceInterface;  public class ServiceImpl implements ServiceInterface {     @Override     public void execute() {         System.out.println(\"Service executed.\");     } }<\/code><\/pre>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <code>com.example.serviceprovider<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u0442\u0443 \u0443\u0441\u043b\u0443\u0433\u0443, \u0435\u0433\u043e <code>module-info.java<\/code> \u043c\u043e\u0433 \u0431\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"java\">module com.example.serviceprovider {     exports com.example.service;     provides com.example.service.ServiceInterface with com.example.service.impl.ServiceImpl; }<\/code><\/pre>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0447\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0443\u0441\u043b\u0443\u0433\u0443, \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b <code>uses<\/code> \u0432 \u0441\u0432\u043e\u0435\u043c \u0444\u0430\u0439\u043b\u0435 <code>module-info.java<\/code>.<\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <code>com.example.serviceconsumer<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u044d\u0442\u0443 \u0443\u0441\u043b\u0443\u0433\u0443:<\/p>\n<pre><code class=\"java\">module com.example.serviceconsumer {     requires com.example.serviceprovider;     uses com.example.service.ServiceInterface; }<\/code><\/pre>\n<p>\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043c\u043e\u0434\u0443\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0443\u0441\u043b\u0443\u0433\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>ServiceLoader<\/code> API. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0434\u0443\u043b\u044c <code>com.example.serviceconsumer<\/code> \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>ServiceInterface<\/code>:<\/p>\n<pre><code class=\"java\">import com.example.service.ServiceInterface; import java.util.ServiceLoader;  public class ServiceConsumer {     public static void main(String[] args) {         ServiceLoader&lt;ServiceInterface> serviceLoader = ServiceLoader.load(ServiceInterface.class);         serviceLoader.forEach(ServiceInterface::execute);     } }<\/code><\/pre>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440: \u0441\u0435\u0440\u0432\u0438\u0441 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432\u0430\u043b\u044e\u0442<\/h4>\n<p>\u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <code>com.example.currencyconverter<\/code>, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>CurrencyConverter<\/code> \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432\u0430\u043b\u044e\u0442. \u041d\u0430\u043c \u0441\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438, \u043d\u0435 \u043c\u0435\u043d\u044f\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043e\u0434 \u043c\u043e\u0434\u0443\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441.<\/p>\n<p>\u0412 \u043c\u043e\u0434\u0443\u043b\u0435 <code>com.example.currencyconverter<\/code>, \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>CurrencyConverter<\/code>:<\/p>\n<pre><code class=\"java\">package com.example.currencyconverter.spi;  public interface CurrencyConverter {     double convert(double amount, String fromCurrency, String toCurrency); } <\/code><\/pre>\n<p>\u0412 <code>module-info.java<\/code> \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u0438\u043c, \u0447\u0442\u043e \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 <code>CurrencyConverter<\/code>:<\/p>\n<pre><code class=\"java\">module com.example.currencyconverter {     exports com.example.currencyconverter.spi;     uses com.example.currencyconverter.spi.CurrencyConverter; }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c <code>com.example.currencyprovider<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u0412 \u044d\u0442\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043a\u043b\u0430\u0441\u0441 <code>MyCurrencyConverter<\/code>:<\/p>\n<pre><code class=\"java\">package com.example.currencyprovider;  import com.example.currencyconverter.spi.CurrencyConverter;  public class MyCurrencyConverter implements CurrencyConverter {     public double convert(double amount, String fromCurrency, String toCurrency) {         \/\/ \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432\u0430\u043b\u044e\u0442         return convertedValue;     } } <\/code><\/pre>\n<p>\u0418 \u0432 \u0435\u0433\u043e <code>module-info.java<\/code> \u043c\u044b \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c, \u0447\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 <code>CurrencyConverter<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0441\u0441\u0430 <code>MyCurrencyConverter<\/code>:<\/p>\n<pre><code class=\"java\">module com.example.currencyprovider {     requires com.example.currencyconverter;     provides com.example.currencyconverter.spi.CurrencyConverter with com.example.currencyprovider.MyCurrencyConverter; } <\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u043c\u043e\u0434\u0443\u043b\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 <code>CurrencyConverter<\/code>, \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435, \u043d\u0435 \u0437\u043d\u0430\u044f, \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u043b\u0430\u0441\u0441 \u0435\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>ServiceLoader<\/code>:<\/p>\n<pre><code class=\"java\">var serviceLoader = ServiceLoader.load(CurrencyConverter.class); for (CurrencyConverter converter : serviceLoader) {     double result = converter.convert(100, \"USD\", \"EUR\");     System.out.println(\"Converted: \" + result); }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <code>CurrencyConverter<\/code> \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441. <\/p>\n<h3>\u0421\u0431\u043e\u0440\u043a\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a<\/h3>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b <code>module-info.java<\/code> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043c\u043e\u0434\u0443\u043b\u0435, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0435\u0433\u043e <code>requires<\/code>, <code>exports<\/code>, \u0438 \u0443\u0441\u043b\u0443\u0433\u0438 <code>uses<\/code> \u0438 <code>provides<\/code>.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>javac<\/code> \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043f\u0443\u0442\u0438 \u043a \u043c\u043e\u0434\u0443\u043b\u044f\u043c <code>--module-path<\/code> \u0438\u043b\u0438 <code>-p<\/code> \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c <code>-d<\/code> \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u044f <code>com.example.myapp<\/code>:<\/p>\n<pre><code>javac -d mods\/com.example.myapp --module-path libs --module-source-path src $(find src\/com.example.myapp -name \"*.java\")<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e <code>mods\/com.example.myapp<\/code>.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u044e\u0437\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>jar<\/code> \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0433\u043e JAR \u0444\u0430\u0439\u043b\u0430. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>--module-version<\/code> \u0438 \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443 <code>module-info.class<\/code>:<\/p>\n<pre><code>jar --create --file=libs\/com.example.myapp@1.0.jar --module-version=1.0 -C mods\/com.example.myapp\/ .<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0439 JAR <code>com.example.myapp@1.0.jar<\/code> \u0432 \u043f\u0430\u043f\u043a\u0435 <code>libs<\/code>.<\/p>\n<p><strong>\u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f,<\/strong> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u043a \u043c\u043e\u0434\u0443\u043b\u044f\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>--module-path<\/code> \u0438\u043b\u0438 <code>-p<\/code>. <\/p>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u043a\u043b\u0430\u0441\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>--module<\/code> \u0438\u043b\u0438 <code>-m<\/code>, \u0433\u0434\u0435 <code>com.example.myapp\/com.example.myapp.Main<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>Main<\/code> \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <code>com.example.myapp<\/code>:<\/p>\n<pre><code>java --module-path libs -m com.example.myapp\/com.example.myapp.Main<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438.<\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Java_Platform_Module_System\">Java Platform Module System <\/a>\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0440\u043e\u0438\u0442 \u0433\u0440\u0430\u0444 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 <code>module-info.java<\/code>. <\/p>\n<p>\u0412\u0441\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044f <code>java.base<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b Java, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <code>java.lang<\/code> \u0438 <code>java.util<\/code>. <em>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Java \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0432\u0441\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044f\u043c \u0431\u0435\u0437 \u044f\u0432\u043d\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f.<\/em><\/p>\n<hr\/>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0430 \u0432 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 <a href=\"https:\/\/otus.pw\/qEXN\/\">\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Java Developer<\/a>. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0432\u0435\u0431\u0438\u043d\u0430\u0440 \u043f\u0440\u043e <a href=\"https:\/\/otus.pw\/qEXN\/\">\u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0432 Java<\/a>. <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/798901\/\"> https:\/\/habr.com\/ru\/articles\/798901\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p><strong>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439<\/strong> \u0432\u00a0Java 9, \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043a\u0430\u043a <em>Project Jigsaw<\/em>,\u00a0\u0431\u044b\u043b\u0430 \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u0430 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0434\u043b\u044f\u00a0\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0440\u044f\u0434\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u00ab<a href=\"https:\/\/dzone.com\/articles\/what-is-jar-hell\">\u0410\u0434 JAR\u2011\u0444\u0430\u0439\u043b\u043e\u0432<\/a>\u00bb \u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0441\u00a0\u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p>\u0418 \u0432\u043e\u0442 \u0441 <a href=\"https:\/\/www.oracle.com\/java\/java9\/\">Java 9<\/a> <strong>\u043c\u043e\u0436\u043d\u043e \u044f\u0432\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/strong>, \u043a\u0430\u043a\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 <strong>\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432\u043d\u0435\u0448\u043d\u0435\u043c\u0443<\/strong> \u043c\u0438\u0440\u0443, \u0430\u00a0\u043a\u0430\u043a\u0438\u0435 <strong>\u0441\u043a\u0440\u044b\u0442\u044b \u0438 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u044b<\/strong> \u043e\u0442\u00a0\u043d\u0435\u0441\u0430\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430. <\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u043d\u043e\u0441\u0438\u0442 <em>\u044f\u0441\u043d\u043e\u0441\u0442\u044c <\/em>\u0438 <em>\u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/em> \u0432\u00a0\u0442\u043e, \u043a\u0430\u043a\u00a0\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u00a0\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438 \u0438 \u0434\u0440\u0443\u0433 \u0441\u00a0\u0434\u0440\u0443\u0433\u043e\u043c. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u044f\u0432\u043d\u044b\u043c\u0438 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c\u0438.<\/p>\n<p><em>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u00a0\u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u00a0\u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0432\u00a0Java.<\/em><\/p>\n<h4>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438 \u0442\u0438\u043f\u044b \u043c\u043e\u0434\u0443\u043b\u0435\u0439   <\/h4>\n<p><strong>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438<\/strong> \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 <a href=\"https:\/\/www.oracle.com\/de\/java\/technologies\/java-se-glance.html\">Java SE<\/a> \u0438 JDE, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 Java\u2011\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>java --list-modules<\/code>, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0438\u0445 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e! \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u00a0\u043d\u0438\u0445:<\/p>\n<pre><code class=\"bash\">java.activation java.base java.compiler java.corba java.datatransfer java.desktop java.instrument java.jnlp java.logging java.management java.management.rmi java.naming java.prefs java.rmi java.scripting java.se java.se.ee java.security.jgss java.security.sasl java.smartcardio java.sql java.sql.rowset<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438<\/strong> &#8212; \u0431\u043b\u043e\u043a\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. <\/p>\n<p><strong>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438<\/strong>, \u2014 \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 JAR-\u0444\u0430\u0439\u043b\u044b \u043a\u0430\u043a \u043c\u043e\u0434\u0443\u043b\u0438, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043d\u0435 \u0431\u044b\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c JAR-\u0444\u0430\u0439\u043b \u043d\u0430 <code>--module-path<\/code>, \u0438 Java \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044c, \u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043e \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 JAR-\u0444\u0430\u0439\u043b\u0430.<\/p>\n<p><strong>\u0411\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438,<\/strong> \u2014 \u044d\u0442\u043e \u0441\u043f\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u0440\u0443\u0433 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u043d\u0430 <code>module-path<\/code>. \u0412\u0441\u0435 JAR-\u0444\u0430\u0439\u043b\u044b, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 <code>--class-path<\/code>, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0431\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u0432\u0441\u0451 \u0432\u0440\u0430\u0449\u0430\u043b\u043e\u0441\u044c \u0432\u043e\u043a\u0440\u0443\u0433 <code>class-path<\/code> \u2014 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 JVM \u0438\u0441\u043a\u0430\u043b\u0430 \u0432\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c <code>module-path<\/code> \u043c\u0430\u0441\u0442\u0445\u0435\u0432 \u0438 \u044e\u0437\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0437\u0434\u0435, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0440\u043e\u0433\u043e\u0435 \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/p>\n<h3>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f  <\/h3>\n<p><strong>\u041c\u043e\u0434\u0443\u043b\u044c \u0432 Java<\/strong> \u2014 \u044d\u0442\u043e <em>\u0441\u0430\u043c\u043e\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0439<\/em>, <em>\u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043f\u0430\u043a\u0435\u0442<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u0434 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 <strong>\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u0432\u043e\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/strong><\/p>\n<p>\u0424\u0430\u0439\u043b <code>module-info.java<\/code> &#8212; <em>\u0446\u0435\u043d\u0442\u0440 \u043c\u043e\u0434\u0443\u043b\u0435\u0439<\/em> \u0432 Java. \u041e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c, \u0435\u0433\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0443\u0441\u043b\u0443\u0433\u0438. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u2014 \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043c\u043e\u0434\u0443\u043b\u044f:<\/p>\n<pre><code class=\"java\">module com.example.myModule {     requires java.sql;     exports com.example.myModule.api;     uses com.example.myModule.spi.MyService;     provides com.example.myModule.spi.MyService with com.example.myModule.internal.MyServiceImpl; }<\/code><\/pre>\n<p><code>requires<\/code>: \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>requires java.sql;<\/code> \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <code>java.sql<\/code> \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p><code>exports<\/code>: \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0443\u043b\u0443\u0447\u0448\u0430\u044f \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044e. <code>exports com.example.myModule.api;<\/code> \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u0430\u043a\u0435\u0442, \u0434\u0435\u043b\u0430\u044f \u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043d\u0435 \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<p><code>uses<\/code>: \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441. \u041c\u043e\u0434\u0443\u043b\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441, \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u043d\u0430\u044e\u0442 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. \u041f\u0440\u0438\u043c\u0435\u0440: <\/p>\n<pre><code class=\"java\">uses com.example.myModule.spi.MyService;<\/code><\/pre>\n<p><code>provides ... with<\/code>: \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442, \u0447\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. <code>provides com.example.myModule.spi.MyService with com.example.myModule.internal.MyServiceImpl;<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e <code>MyServiceImpl<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 <code>MyService<\/code>.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c <code>com.example.data<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0440\u044f\u0434 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 API \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u044b:<\/p>\n<pre><code class=\"java\">module com.example.data {     requires java.logging;     requires transitive com.example.utils;     exports com.example.data.api;     uses com.example.data.spi.DataService;     provides com.example.data.spi.DataService with com.example.data.internal.DataServiceImpl; }<\/code><\/pre>\n<p>\u0414\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 <code>requires transitive com.example.utils;<\/code> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u0439 \u043e\u0442 <code>com.example.data<\/code>, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a <code>com.example.utils<\/code>.<\/p>\n<h3>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0443\u0441\u043b\u0443\u0433<\/h3>\n<p>\u0423\u0441\u043b\u0443\u0433\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438\u043b\u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0443\u0441\u043b\u0443\u0433\u0438 &#8212; \u044d\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043b\u0438 \u043e\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f. \u0414\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0441\u043b\u0443\u0433\u0438 \u0438 \u0435\u0451 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b <code>uses<\/code> \u0438 <code>provides ... with<\/code> \u0432 \u0444\u0430\u0439\u043b\u0435 <code>module-info.java<\/code>.<\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0435\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>ServiceInterface<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0441\u043b\u0443\u0433\u0443, \u0438 \u043a\u043b\u0430\u0441\u0441 <code>ServiceImpl<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u043e\u0439 \u0443\u0441\u043b\u0443\u0433\u0438:<\/p>\n<pre><code class=\"java\">package com.example.service;  public interface ServiceInterface {     void execute(); }<\/code><\/pre>\n<pre><code class=\"java\">package com.example.service.impl;  import com.example.service.ServiceInterface;  public class ServiceImpl implements ServiceInterface {     @Override     public void execute() {         System.out.println(\"Service executed.\");     } }<\/code><\/pre>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <code>com.example.serviceprovider<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u0442\u0443 \u0443\u0441\u043b\u0443\u0433\u0443, \u0435\u0433\u043e <code>module-info.java<\/code> \u043c\u043e\u0433 \u0431\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"java\">module com.example.serviceprovider {     exports com.example.service;     provides com.example.service.ServiceInterface with com.example.service.impl.ServiceImpl; }<\/code><\/pre>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0447\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0443\u0441\u043b\u0443\u0433\u0443, \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b <code>uses<\/code> \u0432 \u0441\u0432\u043e\u0435\u043c \u0444\u0430\u0439\u043b\u0435 <code>module-info.java<\/code>.<\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <code>com.example.serviceconsumer<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u044d\u0442\u0443 \u0443\u0441\u043b\u0443\u0433\u0443:<\/p>\n<pre><code class=\"java\">module com.example.serviceconsumer {     requires com.example.serviceprovider;     uses com.example.service.ServiceInterface; }<\/code><\/pre>\n<p>\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043c\u043e\u0434\u0443\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0443\u0441\u043b\u0443\u0433\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>ServiceLoader<\/code> API. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0434\u0443\u043b\u044c <code>com.example.serviceconsumer<\/code> \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>ServiceInterface<\/code>:<\/p>\n<pre><code class=\"java\">import com.example.service.ServiceInterface; import java.util.ServiceLoader;  public class ServiceConsumer {     public static void main(String[] args) {         ServiceLoader&lt;ServiceInterface> serviceLoader = ServiceLoader.load(ServiceInterface.class);         serviceLoader.forEach(ServiceInterface::execute);     } }<\/code><\/pre>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440: \u0441\u0435\u0440\u0432\u0438\u0441 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432\u0430\u043b\u044e\u0442<\/h4>\n<p>\u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <code>com.example.currencyconverter<\/code>, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>CurrencyConverter<\/code> \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432\u0430\u043b\u044e\u0442. \u041d\u0430\u043c \u0441\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438, \u043d\u0435 \u043c\u0435\u043d\u044f\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043e\u0434 \u043c\u043e\u0434\u0443\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441.<\/p>\n<p>\u0412 \u043c\u043e\u0434\u0443\u043b\u0435 <code>com.example.currencyconverter<\/code>, \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>CurrencyConverter<\/code>:<\/p>\n<pre><code class=\"java\">package com.example.currencyconverter.spi;  public interface CurrencyConverter {     double convert(double amount, String fromCurrency, String toCurrency); } <\/code><\/pre>\n<p>\u0412 <code>module-info.java<\/code> \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u0438\u043c, \u0447\u0442\u043e \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 <code>CurrencyConverter<\/code>:<\/p>\n<pre><code class=\"java\">module com.example.currencyconverter {     exports com.example.currencyconverter.spi;     uses com.example.currencyconverter.spi.CurrencyConverter; }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c <code>com.example.currencyprovider<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u0412 \u044d\u0442\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043a\u043b\u0430\u0441\u0441 <code>MyCurrencyConverter<\/code>:<\/p>\n<pre><code class=\"java\">package com.example.currencyprovider;  import com.example.currencyconverter.spi.CurrencyConverter;  public class MyCurrencyConverter implements CurrencyConverter {     public double convert(double amount, String fromCurrency, String toCurrency) {         \/\/ \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432\u0430\u043b\u044e\u0442         return convertedValue;     } } <\/code><\/pre>\n<p>\u0418 \u0432 \u0435\u0433\u043e <code>module-info.java<\/code> \u043c\u044b \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c, \u0447\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 <code>CurrencyConverter<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0441\u0441\u0430 <code>MyCurrencyConverter<\/code>:<\/p>\n<pre><code class=\"java\">module com.example.currencyprovider {     requires com.example.currencyconverter;     provides com.example.currencyconverter.spi.CurrencyConverter with com.example.currencyprovider.MyCurrencyConverter; } <\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u043c\u043e\u0434\u0443\u043b\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 <code>CurrencyConverter<\/code>, \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435, \u043d\u0435 \u0437\u043d\u0430\u044f, \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u043b\u0430\u0441\u0441 \u0435\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>ServiceLoader<\/code>:<\/p>\n<pre><code class=\"java\">var serviceLoader = ServiceLoader.load(CurrencyConverter.class); for (CurrencyConverter converter : serviceLoader) {     double result = converter.convert(100, \"USD\", \"EUR\");     System.out.println(\"Converted: \" + result); }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <code>CurrencyConverter<\/code> \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441. <\/p>\n<h3>\u0421\u0431\u043e\u0440\u043a\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a<\/h3>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b <code>module-info.java<\/code> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043c\u043e\u0434\u0443\u043b\u0435, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0435\u0433\u043e <code>requires<\/code>, <code>exports<\/code>, \u0438 \u0443\u0441\u043b\u0443\u0433\u0438 <code>uses<\/code> \u0438 <code>provides<\/code>.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>javac<\/code> \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043f\u0443\u0442\u0438 \u043a \u043c\u043e\u0434\u0443\u043b\u044f\u043c <code>--module-path<\/code> \u0438\u043b\u0438 <code>-p<\/code> \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c <code>-d<\/code> \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u044f <code>com.example.myapp<\/code>:<\/p>\n<pre><code>javac -d mods\/com.example.myapp --module-path libs --module-source-path src $(find src\/com.example.myapp -name \"*.java\")<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e <code>mods\/com.example.myapp<\/code>.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u044e\u0437\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>jar<\/code> \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0433\u043e JAR \u0444\u0430\u0439\u043b\u0430. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>--module-version<\/code> \u0438 \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443 <code>module-info.class<\/code>:<\/p>\n<pre><code>jar --create --file=libs\/com.example.myapp@1.0.jar --module-version=1.0 -C mods\/com.example.myapp\/ .<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0439 JAR <code>com.example.myapp@1.0.jar<\/code> \u0432 \u043f\u0430\u043f\u043a\u0435 <code>libs<\/code>.<\/p>\n<p><strong>\u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f,<\/strong> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u043a \u043c\u043e\u0434\u0443\u043b\u044f\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>--module-path<\/code> \u0438\u043b\u0438 <code>-p<\/code>. <\/p>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u043a\u043b\u0430\u0441\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>--module<\/code> \u0438\u043b\u0438 <code>-m<\/code>, \u0433\u0434\u0435 <code>com.example.myapp\/com.example.myapp.Main<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>Main<\/code> \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <code>com.example.myapp<\/code>:<\/p>\n<pre><code>java --module-path libs -m com.example.myapp\/com.example.myapp.Main<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438.<\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Java_Platform_Module_System\">Java Platform Module System <\/a>\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0440\u043e\u0438\u0442 \u0433\u0440\u0430\u0444 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 <code>module-info.java<\/code>. <\/p>\n<p>\u0412\u0441\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044f <code>java.base<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b Java, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <code>java.lang<\/code> \u0438 <code>java.util<\/code>. <em>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/em><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-370286","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/370286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=370286"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/370286\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=370286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=370286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=370286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}