{"id":4563,"date":"2025-05-08T17:39:36","date_gmt":"2025-05-08T15:39:36","guid":{"rendered":"https:\/?p=4563"},"modified":"2025-05-15T13:53:58","modified_gmt":"2025-05-15T11:53:58","slug":"capitulo-1-programacion-en-oracle-java-se-21","status":"publish","type":"post","link":"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/","title":{"rendered":"Chapter 1: Introduction to programming in Oracle Java SE 21 LTS."},"content":{"rendered":"<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"http:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/Oracle-Java-21-SE-with-MX-Linux-and-a-steaming-cup-of-coffee-at-1080p-300x169.jpg\" alt=\"\" class=\"wp-image-4564\" style=\"width:1200px;height:auto\"\/><\/figure>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Article table of contents.<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#Curso_de_Oracle_Java_SE_21_LTS_a_Fondo\" >In-depth Oracle Java SE 21 LTS Course<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#1_Introduccion_a_Java_y_la_Programacion_Orientada_a_Objetos_POO\" >1. Introduction to Java and Object-Oriented Programming (OOP)<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#11_Programacion_Orientada_a_Objetos_en_Java\" >1.1. Object-Oriented Programming in Java<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#2_%C2%BFQue_es_Oracle_Java_SE_21_LTS\" >2. What is Oracle Java SE 21 LTS?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#3_Historia_del_Lenguaje_Java_y_su_Inventor\" >3. History of the Java Language and its Inventor<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#4_Tecnologias_Java\" >4. Java Technologies<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#5_%C2%BFQue_es_el_JDK\" >5. What is the JDK?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#6_Instalacion_del_JDK_de_Oracle_Java_SE_21_LTS_en_Diferentes_Sistemas_Operativos\" >6. Installing Oracle Java SE 21 LTS JDK on Different Operating Systems<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#61_En_Windows_11\" >6.1. In Windows 11<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#62_En_MacOS\" >6.2. On MacOS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#63_En_Debian_Ubuntu_Linux_Mint_y_MX%E2%80%91Linux\" >6.3. On Debian, Ubuntu, Linux Mint and MX\u2011Linux<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#7_Compilacion_Ejecucion_Depuracion_y_Empaquetado_con_JAR\" >7. Compiling, Running, Debugging, and Packaging with JAR<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#71_Compilacion_y_Ejecucion_desde_la_Linea_de_Comandos\" >7.1. Compiling and Running from the Command Line<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#72_Depuracion_con_el_Depurador_JDB\" >7.2. Debugging with the JDB Debugger<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#73_Empaquetado_y_Uso_de_Archivos_JAR\" >7.3. Packaging and Using JAR Files<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#8_IDEs_de_Programacion_Java_de_Codigo_Abierto\" >8. Open Source Java Programming IDEs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#9_Gestion_de_Librerias_y_Dependencias_con_Maven\" >9. Managing Libraries and Dependencies with Maven<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#10_Caracteristicas_de_Oracle_Java_SE_21_LTS\" >10. Features of Oracle Java SE 21 LTS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#11_Novedades_de_Oracle_Java_SE_21_LTS\" >11. What&#039;s New in Oracle Java SE 21 LTS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#12_Aplicaciones_y_Proyectos_que_se_Pueden_Desarrollar_en_Java\" >12. Applications and Projects that Can be Developed in Java<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#13_Programa_Explicativo_%C2%ABHola_Mundo%C2%BB_en_Java\" >13. Explanatory Program &quot;Hello World&quot; in Java<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#14_Conclusiones\" >14. Conclusions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#15_Resumen_del_Capitulo\" >15. Chapter Summary<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#16_Referencias\" >16. References<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/#17_Mirada_Hacia_Adelante\" >17. Looking Ahead<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Curso_de_Oracle_Java_SE_21_LTS_a_Fondo\"><\/span>In-depth Oracle Java SE 21 LTS Course<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<p>This first chapter lays the foundation for working with Oracle Java SE 21 LTS, the LTS version supported by Oracle. Here you&#039;ll learn about the origins and history of the language, its philosophy, and Object-Oriented Programming (OOP), including detailed installation and configuration of the JDK on major operating systems. It also explains the complete development cycle: compilation, execution, debugging, and packaging (via JAR files) using the tools included in the JDK. It also describes the various applications and projects that can be developed with Java, and delves deeper into Object-Oriented Programming in Java. This guide lays the groundwork for addressing more advanced topics in later chapters.<\/p>\r\n<p>Currently, I am studying <strong>Java SE<\/strong> So I&#039;ve decided to create my first course on this programming language and thus learn, and help other students become Java programmers. It&#039;s a concise, no-nonsense, straight-to-the-point article to help you quickly learn how to develop software in Linux, a perfect guide to learn quickly and find work as soon as possible. The course is completely free with a Creative Commons license and the code is GPL. The course will be divided into chapters and I hope it will help you as much as it has me. The IDEs we&#039;ll be using are the Eclipse IDE, Visual Studio Code, and the Linux terminal. I&#039;ve chosen the Java SE 21 JDK because it&#039;s an LTS version, but we&#039;re already on Java SE 24, which is a minor Oracle version.<\/p>\r\n<h2 class=\"western wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Introduccion_a_Java_y_la_Programacion_Orientada_a_Objetos_POO\"><\/span>1. Introduction to Java and Object-Oriented Programming (OOP)<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>Oracle Java SE 21 LTS is framed in the philosophy <strong>\u00abWrite Once, Run Anywhere\u00bb<\/strong>, since the source code is compiled into bytecode, which is interpreted by the Java Virtual Machine (JVM). This allows the same application to run seamlessly on different operating systems without modification.<\/p>\r\n<p>Object-Oriented Programming is the fundamental pillar of Java. Dividing code into classes and objects promotes modularity, maintainability, and reuse, which is essential in large and complex projects. Below, we delve into the basic principles of OOP.<\/p>\r\n<h3 class=\"western\"><span class=\"ez-toc-section\" id=\"11_Programacion_Orientada_a_Objetos_en_Java\"><\/span>1.1. Object-Oriented Programming in Java<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>OOP is based on four essential pillars:<\/p>\r\n<ul>\r\n<li>\r\n<p><strong>Encapsulation:<\/strong> It consists of hiding the internal data of a class and exposing only the methods necessary for its manipulation. Access modifiers are used (<em>private<\/em>, <em>protected<\/em>, <em>public<\/em>) along with methods <em>getter<\/em> and <em>setter<\/em>. <strong>Example:<\/strong><\/p>\r\n<p>java<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-java\" data-line=\"\" data-no-auto-translation=\"\">      public class Persona {\n          private String nombre; \/\/ Atributo privado\n      \n          public String getNombre() {\n              return nombre;\n          }\n      \n          public void setNombre(String nombre) {\n              this.nombre = nombre;\n          }\n      }<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p><strong>Inheritance:<\/strong> It allows you to create new classes from existing classes, inheriting their attributes and methods to extend or specialize functionalities. <strong>Example:<\/strong><\/p>\r\n<p>java<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-java\" data-line=\"\" data-no-auto-translation=\"\">      public class Animal {\n          public void comer() {\n              System.out.println(&quot;El animal est\u00e1 comiendo&quot;);\n          }\n      }\n      \n      public class Perro extends Animal {\n          public void ladrar() {\n              System.out.println(&quot;El perro ladra&quot;);\n          }\n      }\n      \n      \/\/ Uso:\n      Perro miPerro = new Perro();\n      miPerro.comer();  \/\/ M\u00e9todo heredado\n      miPerro.ladrar(); \/\/ M\u00e9todo propio<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p><strong>Polymorphism:<\/strong> It allows the same variable or method to behave differently depending on the object that contains it. For example, you can have a reference to a parent type and assign it to an object of a derived class, taking advantage of method overriding. <strong>Example:<\/strong><\/p>\r\n<p>java<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-java\" data-line=\"\" data-no-auto-translation=\"\">      Animal miAnimal = new Perro();\n      miAnimal.comer(); \/\/ Se ejecuta el m\u00e9todo definido en Animal\n      \/\/ Para acceder a m\u00e9todos espec\u00edficos de Perro, se podr\u00eda realizar un casting.<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p><strong>Abstraction:<\/strong> It consists of defining abstract classes or interfaces that establish a model or contract for the classes that implement them, leaving the concrete implementation to the derived classes. <strong>Example:<\/strong><\/p>\r\n<p>java<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-java\" data-line=\"\" data-no-auto-translation=\"\">      public abstract class Forma {\n          public abstract double calcularArea();\n      }\n      \n      public class Circulo extends Forma {\n          private double radio;\n          \n          public Circulo(double radio) {\n              this.radio = radio;\n          }\n          \n          @Override\n          public double calcularArea() {\n              return Math.PI * radio * radio;\n          }\n      }<\/code><\/pre>\r\n<\/li>\r\n<\/ul>\r\n<p>These principles facilitate the development of modular, scalable, and maintainable applications, cementing the importance of OOP in the Java ecosystem. I don&#039;t expect you to understand or know what object-oriented programming is; it&#039;s simply a first introduction, explaining it from scratch.<\/p>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"2_%C2%BFQue_es_Oracle_Java_SE_21_LTS\"><\/span>2. What is Oracle Java SE 21 LTS?<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>Oracle Java SE 21 LTS is the latest version of the Java language supported by Oracle. Its key features include:<\/p>\r\n<ul>\r\n<li>\r\n<p><strong>Portability:<\/strong> Applications are compiled to bytecode, ensuring they run seamlessly on Windows, macOS, Linux, and other systems without modification.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Safety and Robustness:<\/strong> It features rigorous exception handling, an advanced Garbage Collector, and strict syntax that helps minimize runtime errors.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Extensive Standard Library:<\/strong> It offers an extensive set of APIs for managing common tasks, from data manipulation to accessing network services and databases.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<p>These features make Oracle Java SE 21 LTS ideal for developing enterprise solutions, mobile and desktop applications, and even high-performance embedded systems.<\/p>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"3_Historia_del_Lenguaje_Java_y_su_Inventor\"><\/span>3. History of the Java Language and its Inventor<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>Java was born at Sun Microsystems in the mid-1990s, thanks to the innovative vision of James Gosling and his team, who sought to create a simple, powerful, and portable language to meet the challenges of an ever-growing digital environment. Since its official launch in 1995, Java has transformed the software industry, providing robust and scalable solutions for developing cross-platform applications.<\/p>\r\n<p>In 2010, Sun Microsystems was acquired by <strong>Oracle<\/strong>, which has since been the primary entity promoting and maintaining the language. Oracle has continued to evolve Java, implementing improvements in security, performance, and modernization of its APIs, solidifying Oracle Java SE 21 LTS as the preferred version for critical and large-scale projects.<\/p>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"4_Tecnologias_Java\"><\/span>4. Java Technologies<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>The Java ecosystem extends to diverse areas to adapt to multiple development needs:<\/p>\r\n<ul>\r\n<li>\r\n<p><strong>Java Standard Edition (SE):<\/strong> The basis for developing desktop applications and utilities.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Java Enterprise Edition (EE):<\/strong> Oriented to distributed applications, web services and transactional systems.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Java Micro Edition (ME):<\/strong> Designed for mobile devices and embedded systems, taking advantage of limited resources.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>JavaFX:<\/strong> Modern platform for creating sophisticated graphical interfaces, surpassing Swing in functionality and performance.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<p>Each technology specializes in a specific area, allowing the full potential of language to be exploited.<\/p>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"5_%C2%BFQue_es_el_JDK\"><\/span>5. What is the JDK?<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>The Oracle Java SE 21 LTS Java Development Kit (JDK) is the complete set of tools required to develop, compile, run, and debug Java applications. Its core components include:<\/p>\r\n<ul>\r\n<li>\r\n<p><strong>The Compiler (<\/strong><code class=\"\" data-line=\"\" data-no-auto-translation=\"\">javac<\/code><strong>):<\/strong> Converts source code (.java) to bytecode (.class) for execution on the JVM.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>The JVM:<\/strong> It executes the bytecode on a hardware abstraction layer, ensuring portability.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>The Standard Libraries:<\/strong> They provide an extensive set of APIs ready to use in any project.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Complementary Tools:<\/strong> Includes the debugger (<em>jdb<\/em>) for real-time analysis, utilities for generating documentation and the tool <em>jar<\/em> to package applications.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<p>Mastering the JDK is essential to taking full advantage of Oracle Java SE 21 LTS.<\/p>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"6_Instalacion_del_JDK_de_Oracle_Java_SE_21_LTS_en_Diferentes_Sistemas_Operativos\"><\/span>6. Installing Oracle Java SE 21 LTS JDK on Different Operating Systems<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>Java environment variables are global settings set on the operating system that allow Java-related tools and programs (such as the compiler, the Java Virtual Machine, and other utilities) to correctly find and use the resources needed to compile and run applications.<\/p>\r\n<p>The main environment variables in the context of Java and their functions are detailed below:<\/p>\r\n<ol start=\"1\">\r\n<li>\r\n<p><strong>JAVA_HOME<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p><strong>What is it?<\/strong> It is a variable that points to the root folder where the JDK (Java Development Kit) is installed.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>What is it for?<\/strong> Allows programs and build tools (such as Maven, Gradle, Ant, and others) to quickly and easily locate all JDK resources, such as the compiler (<code class=\"\" data-line=\"\" data-no-auto-translation=\"\">javac<\/code>), the Java Virtual Machine (<code class=\"\" data-line=\"\" data-no-auto-translation=\"\">java<\/code>) and other utilities. This is essential for scripts and IDEs to know where to look for the Java development environment.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>\r\n<p><strong>PATH<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p><strong>What is it?<\/strong> It is a variable that contains a list of directories in which the operating system searches for program executables.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>What is it for?<\/strong> By including the directory <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">bin<\/code> of the JDK (usually referenced through <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">JAVA_HOME<\/code>, For example, <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">%JAVA_HOME%\\bin<\/code> on Windows or <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">$JAVA_HOME\/bin<\/code> on Unix\/Linux\/macOS) in the environment variable <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">PATH<\/code>, you are allowed to run commands like <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">java<\/code>, <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">javac<\/code>, <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">jar<\/code> and others from any location in the terminal without having to specify the full path.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>\r\n<p><strong>CLASSPATH<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p><strong>What is it?<\/strong> It is a variable that tells the Java runtime environment where to locate the external classes and libraries needed to run a program.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>What is it for?<\/strong> During compilation and execution, the JVM uses <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">CLASSPATH<\/code> to find the definitions of necessary classes and packages. If your project depends on external libraries (such as JAR files), you can include them in the <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">CLASSPATH<\/code> so they&#039;re accessible. While in many cases it&#039;s recommended to leave it at its default value (usually the current directory, indicated by a &quot;.&quot;), in complex projects or when working without a dependency manager, it&#039;s useful to set it explicitly.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ol>\r\n<p><strong>Summary:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p><strong>JAVA_HOME<\/strong> is used to tell your system where the JDK is installed.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>PATH<\/strong> It is set up so that you can access Java executables without providing full paths each time.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>CLASSPATH<\/strong> helps the JVM locate classes and libraries needed to run your applications.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<p>These variables are essential for properly configuring the Java development environment and ensure that all tools work seamlessly and seamlessly. Keeping them configured correctly is key both for working in the command line and for using IDEs and build systems that rely on these values.<\/p>\r\n<p>To ensure an optimal development environment, it&#039;s essential to properly install the JDK and configure the appropriate environment variables. The process for Windows 11, macOS, and MX-Linux is detailed below.<\/p>\r\n<figure id=\"attachment_4571\" aria-describedby=\"caption-attachment-4571\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-4571 size-medium\" src=\"http:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/windows-11-300x168.jpg\" alt=\"\" width=\"300\" height=\"168\" srcset=\"https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/windows-11-300x168.jpg 300w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/windows-11-1024x575.jpg 1024w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/windows-11-768x431.jpg 768w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/windows-11-100x56.jpg 100w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/windows-11-1536x862.jpg 1536w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/windows-11-2048x1149.jpg 2048w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-4571\" class=\"wp-caption-text\">Windows 11<\/figcaption><\/figure>\r\n<h3 class=\"western\"><span class=\"ez-toc-section\" id=\"61_En_Windows_11\"><\/span>6.1. In Windows 11<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p><strong>Step 1 \u2013 Download and Install the JDK:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>Download the installer (file <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">.exe<\/code>) from for Oracle Java SE 21 LTS.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Run the installer and follow the wizard. By default, the JDK is installed in:<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-powershell\" data-line=\"\" data-no-auto-translation=\"\">C:\\Program Files\\Java\\jdk-21<\/code><\/pre>\r\n<\/li>\r\n<\/ul>\r\n<p><strong>Step 2 \u2013 Setting Environment Variables:<\/strong><\/p>\r\n<ol>\r\n<li>\r\n<p><strong>JAVA_HOME:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>Right-click on \u201cThis PC\u201d and select \u201cProperties.\u201d<\/p>\r\n<\/li>\r\n<li>\r\n<p>Go to \u201cAdvanced system settings\u201d and click \u201cEnvironment variables\u2026\u201d.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Under \u201cSystem Variables,\u201d click \u201cNew\u2026\u201d and set:<\/p>\r\n<ul>\r\n<li>\r\n<p><strong>Variable name:<\/strong> <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">JAVA_HOME<\/code><\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Worth:<\/strong><\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-powershell\" data-line=\"\" data-no-auto-translation=\"\">C:\\Program Files\\Java\\jdk-21<\/code><\/pre>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>\r\n<p><strong>PATH:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>In the same window, select the variable <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">Path<\/code> and click \u201cEdit\u2026\u201d.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Add a new entry:<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">%JAVA_HOME%\\bin<\/code><\/pre>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>\r\n<p><strong>CLASSPATH (Optional):<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>For a complete configuration, create a new variable:<\/p>\r\n<ul>\r\n<li>\r\n<p><strong>Variable name:<\/strong> <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">CLASSPATH<\/code><\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Worth:<\/strong><\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">.;%JAVA_HOME%\\lib<\/code><\/pre>\r\n<\/li>\r\n<\/ul>\r\n<p><em>(The \u201c.\u201d indicates the current directory; in Windows the separator is \u201c;\u201d).<\/em><\/p>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ol>\r\n<p><strong>Step 3 \u2013 Verification:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>Open Command Prompt and run:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">java -version\njavac -version<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p>The output should show Oracle Java version 21, confirming that the installation and configuration were successful.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<figure id=\"attachment_4577\" aria-describedby=\"caption-attachment-4577\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-4577 size-medium\" src=\"http:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/W-300x169.webp\" alt=\"\" width=\"300\" height=\"169\" srcset=\"https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/W-300x169.webp 300w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/W-1024x576.webp 1024w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/W-768x432.webp 768w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/W-100x56.webp 100w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/W.webp 1280w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-4577\" class=\"wp-caption-text\">MacOS<\/figcaption><\/figure>\r\n<h3 class=\"western\"><span class=\"ez-toc-section\" id=\"62_En_MacOS\"><\/span>6.2. On MacOS<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Since I don&#039;t have a MacOS computer, I can&#039;t verify that this solution is correct and works. I relied on Google to find the solution to install the JDK on the bitten apple operating systems.\u00a0<\/p>\r\n<p><strong>Step 1 \u2013 Download and Install the JDK:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>Download the file <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">.dmg<\/code> either <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">.pkg<\/code> from the for Oracle Java SE 21 LTS.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Run the installer and follow the instructions. By default, the JDK is installed in:<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">\/Library\/Java\/JavaVirtualMachines\/jdk-21.jdk\/Contents\/Home<\/code><\/pre>\r\n<\/li>\r\n<\/ul>\r\n<p><strong>Step 2 \u2013 Setting Environment Variables:<\/strong><\/p>\r\n<ol>\r\n<li>\r\n<p><strong>JAVA_HOME:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>Open your shell&#039;s configuration file (for example, <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">~\/.zshrc<\/code> either <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">~\/.bash_profile<\/code>) and adds:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">export JAVA_HOME=\/Library\/Java\/JavaVirtualMachines\/jdk-21.jdk\/Contents\/Home<\/code><\/pre>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>\r\n<p><strong>PATH:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>In the same file, add:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">export PATH=$JAVA_HOME\/bin:$PATH<\/code><\/pre>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>\r\n<p><strong>CLASSPATH (Optional):<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>Also add:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">export CLASSPATH=.:$JAVA_HOME\/lib<\/code><\/pre>\r\n<p><em>(On macOS, \u201c:\u201d is the path separator and \u201c.\u201d indicates the current directory.)<\/em><\/p>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ol>\r\n<p><strong>Step 3 \u2013 Apply Settings and Verify:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>Save the changes and reload the configuration file:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">source ~\/.zshrc<\/code><\/pre>\r\n<p><em>(EITHER <\/em><code class=\"\" data-line=\"\" data-no-auto-translation=\"\">source ~\/.bash_profile<\/code><em> as appropriate)<\/em><\/p>\r\n<\/li>\r\n<li>\r\n<p>Open Terminal and run:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">java -version \njavac -version<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p>The output should confirm the installation of Oracle Java SE 21 LTS.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<h3><img decoding=\"async\" class=\"size-medium wp-image-4578 aligncenter\" src=\"http:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/tux_kernel_350-300x300.webp\" alt=\"\" width=\"300\" height=\"300\" srcset=\"https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/tux_kernel_350-300x300.webp 300w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/tux_kernel_350-150x150.webp 150w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/tux_kernel_350-100x100.webp 100w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/tux_kernel_350.webp 350w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/h3>\r\n<h3 class=\"western\"><span class=\"ez-toc-section\" id=\"63_En_Debian_Ubuntu_Linux_Mint_y_MX%E2%80%91Linux\"><\/span>6.3. On Debian, Ubuntu, Linux Mint and MX\u2011Linux<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>&nbsp;<\/p>\r\n<p><strong>Step 1 \u2013 Installing the JDK:<\/strong><\/p>\r\n<p><em>You have two options:<\/em><\/p>\r\n<p><strong>Option A \u2013 Installation via Package Manager:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>If Oracle Java SE 21 LTS or an equivalent version (such as OpenJDK 21) is available in the repositories, run:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">$ sudo apt install openjdk-21-jdk<\/code><\/pre>\r\n<\/li>\r\n<\/ul>\r\n<p><strong>Option B \u2013 Manual Installation:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>Download the file from Oracle, Java SE 21 LTS.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Extract the contents into a directory, for example:<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">\/opt\/java\/jdk-21<\/code><\/pre>\r\n<\/li>\r\n<\/ul>\r\n<p><strong>Step 2 \u2013 Setting Environment Variables:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>Open your shell configuration file (for example, <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">~\/.bashrc<\/code> either <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">~\/.profile<\/code>) and adds:<\/p>\r\n<ol>\r\n<li>\r\n<p><strong>JAVA_HOME:<\/strong><\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">export JAVA_HOME=\/opt\/java\/jdk-21<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p><strong>PATH:<\/strong><\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">export PATH=$JAVA_HOME\/bin:$PATH<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p><strong>CLASSPATH (Optional):<\/strong><\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">export CLASSPATH=.:$JAVA_HOME\/lib<\/code><\/pre>\r\n<p><em>(In Linux, \u201c:\u201d is the separator and \u201c.\u201d indicates the current directory.)<\/em><\/p>\r\n<\/li>\r\n<\/ol>\r\n<\/li>\r\n<\/ul>\r\n<p><strong>Step 3 \u2013 Apply Settings and Verify:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p>Save the changes and reload the file:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">source ~\/.bashrc<\/code><\/pre>\r\n<p><em>(EITHER <\/em><code class=\"\" data-line=\"\" data-no-auto-translation=\"\">source ~\/.profile<\/code><em>)<\/em><\/p>\r\n<\/li>\r\n<li>\r\n<p>In the terminal, verify the installation:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">$ java -version \n$ javac -version<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p>The output should show Oracle Java SE 21 LTS, confirming the correct installation and configuration.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"7_Compilacion_Ejecucion_Depuracion_y_Empaquetado_con_JAR\"><\/span>7. Compiling, Running, Debugging, and Packaging with JAR<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<h3 class=\"western\"><span class=\"ez-toc-section\" id=\"71_Compilacion_y_Ejecucion_desde_la_Linea_de_Comandos\"><\/span>7.1. Compiling and Running from the Command Line<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Consider the classic \u201cHello World\u201d example:<\/p>\r\n<p>java<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-java\" data-line=\"\" data-no-auto-translation=\"\">public class HolaMundo {\n    public static void main(String[] args) {\n        System.out.println(&quot;Hola Mundo&quot;);\n    }\n}<\/code><\/pre>\r\n<ol>\r\n<li>\r\n<p><strong>Compilation:<\/strong><\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">javac HolaMundo.java<\/code><\/pre>\r\n<p>This will generate the file <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">HolaMundo.class<\/code>.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Execution:<\/strong><\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">java HolaMundo<\/code><\/pre>\r\n<\/li>\r\n<\/ol>\r\n<h3 class=\"western\"><span class=\"ez-toc-section\" id=\"72_Depuracion_con_el_Depurador_JDB\"><\/span>7.2. Debugging with the JDB Debugger<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Oracle Java SE 21 LTS includes the debugger <em>jdb<\/em>, which allows you to inspect the execution flow and variable values. For example, to calculate the factorial of a number:<\/p>\r\n<p>java<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-java\" data-line=\"\" data-no-auto-translation=\"\">public class DepuracionEjemplo {\n    public static void main(String[] args) {\n        int n = 5;\n        for (int i = 1; i &lt;= n; i++) {\n            int factorial = calcularFactorial(i);\n            System.out.println(&quot;El factorial de &quot; + i + &quot; es: &quot; + factorial);\n        }\n    }\n\n    public static int calcularFactorial(int num) {\n        int resultado = 1;\n        for (int i = 1; i &lt;= num; i++) {\n            resultado = resultado * i; \/\/ Punto de interrupci\u00f3n recomendado.\n        }\n        return resultado;\n    }\n}<\/code><\/pre>\r\n<p><strong>Steps to use jdb<\/strong><strong>:<\/strong><\/p>\r\n<ol>\r\n<li>\r\n<p>Compile the program:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">javac DepuracionEjemplo.java<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p>Start the debugger:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">jdb DepuracionEjemplo<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p>Set a breakpoint (e.g. on the calculation line):<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">stop at DepuracionEjemplo:15<\/code><\/pre>\r\n<p><em>(Adjust the line number if necessary.)<\/em><\/p>\r\n<\/li>\r\n<li>\r\n<p>Run the program in debug mode:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">run<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p>Inspect variables:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">print i \nprint resultado<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p>Use <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">step<\/code> to advance line by line and <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">cont<\/code> to continue to the next breakpoint or finish.<\/p>\r\n<\/li>\r\n<\/ol>\r\n<h3 class=\"western\"><span class=\"ez-toc-section\" id=\"73_Empaquetado_y_Uso_de_Archivos_JAR\"><\/span>7.3. Packaging and Using JAR Files<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<p>Packaging an entire application into a JAR file is essential for its distribution. A JAR is a compressed file that includes the bytecode and all necessary resources, along with a manifest that defines the entry point.<\/p>\r\n<h4 class=\"western\">Steps to create a JAR file:<\/h4>\r\n<ol>\r\n<li>\r\n<p><strong>Create a manifest file:<\/strong> Create a file called <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">manifest.txt<\/code> with the following content:<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">Main-Class: HolaMundo<\/code><\/pre>\r\n<p><em>(Leave a blank line at the end.)<\/em><\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Package the JAR:<\/strong> Run:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">jar cfm HolaMundo.jar manifest.txt HolaMundo.class<\/code><\/pre>\r\n<ul>\r\n<li>\r\n<p><code class=\"\" data-line=\"\" data-no-auto-translation=\"\">c<\/code> creates the JAR file.<\/p>\r\n<\/li>\r\n<li>\r\n<p><code class=\"\" data-line=\"\" data-no-auto-translation=\"\">f<\/code> defines the file name.<\/p>\r\n<\/li>\r\n<li>\r\n<p><code class=\"\" data-line=\"\" data-no-auto-translation=\"\">m<\/code> use the custom manifest.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li>\r\n<p><strong>Check Content:<\/strong> List the contents with:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">jar tf HolaMundo.jar<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p><strong>Run the JAR:<\/strong> Launch the app with:<\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">java -jar HolaMundo.jar<\/code><\/pre>\r\n<p>The JVM will use the manifest to locate the method <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">main<\/code>.<\/p>\r\n<\/li>\r\n<\/ol>\r\n<h2><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4580 aligncenter\" src=\"http:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/teaserImage_xxxx_croppedTeaserImage-300x124.jpg\" alt=\"\" width=\"300\" height=\"124\" srcset=\"https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/teaserImage_xxxx_croppedTeaserImage-300x124.jpg 300w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/teaserImage_xxxx_croppedTeaserImage-1024x424.jpg 1024w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/teaserImage_xxxx_croppedTeaserImage-768x318.jpg 768w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/teaserImage_xxxx_croppedTeaserImage-100x41.jpg 100w, https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/teaserImage_xxxx_croppedTeaserImage.jpg 1140w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/h2>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"8_IDEs_de_Programacion_Java_de_Codigo_Abierto\"><\/span>8. Open Source Java Programming IDEs<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>Integrated Development Environments (IDEs) streamline development with features such as autocompletion, refactoring, and visual debugging. For Oracle Java SE 21 LTS, the following are recommended:<\/p>\r\n<ul>\r\n<li>\r\n<p><strong>Eclipse:<\/strong> With a broad plugin ecosystem and an active community that makes managing complex projects easy.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>NetBeans:<\/strong> With native integration with the Oracle JDK, it simplifies development and debugging.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>IntelliJ IDEA Community Edition:<\/strong> Noted for its smart autocompletion and powerful refactoring tools.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Visual Studio Code (VS Code):<\/strong> A lightweight editor that, through specialized extensions (for example, the Java Extension Pack), allows you to manage projects, debug, and manage dependencies in an agile and modern way.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"9_Gestion_de_Librerias_y_Dependencias_con_Maven\"><\/span>9. Managing Libraries and Dependencies with Maven<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>Maven is the standard tool for managing Java projects. Its advantages include:<\/p>\r\n<ul>\r\n<li>\r\n<p><strong>Centralization in <\/strong><code class=\"\" data-line=\"\" data-no-auto-translation=\"\">pom.xml<\/code><strong>:<\/strong> All dependencies, plugins and configurations are defined in a single file.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Automation:<\/strong> Maven downloads, updates, and organizes the necessary libraries, which greatly simplifies maintenance.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Standardized Structure:<\/strong> Facilitates continuous integration and automated deployment following widely recognized conventions.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<p><strong>Basic example of <\/strong><code class=\"\" data-line=\"\" data-no-auto-translation=\"\">pom.xml<\/code><strong>:<\/strong><\/p>\r\n<p>xml<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-apacheconf\" data-line=\"\" data-no-auto-translation=\"\">&lt;project xmlns=&quot;http:\/\/maven.apache.org\/POM\/4.0.0&quot; \n         xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; \n         xsi:schemaLocation=&quot;http:\/\/maven.apache.org\/POM\/4.0.0 \n         http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd&quot;&gt;\n    &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n    &lt;groupId&gt;com.ejemplo&lt;\/groupId&gt;\n    &lt;artifactId&gt;hola-mundo&lt;\/artifactId&gt;\n    &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;\n    &lt;dependencies&gt;\n        &lt;!-- Dependencias definidas aqu\u00ed --&gt;\n    &lt;\/dependencies&gt;\n&lt;\/project&gt;<\/code><\/pre>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"10_Caracteristicas_de_Oracle_Java_SE_21_LTS\"><\/span>10. Features of Oracle Java SE 21 LTS<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>Oracle Java SE 21 LTS features:<\/p>\r\n<ul>\r\n<li>\r\n<p><strong>Total Portability:<\/strong> Bytecode generation allows the same application to run on multiple systems without modification.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Safety and Robustness:<\/strong> Advanced exception handling and an efficient Garbage Collector provide a reliable environment.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Object Orientation:<\/strong> It facilitates code modularity, reuse, and scalability, ideal for large-scale projects.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Concurrency Support:<\/strong> It incorporates native tools for multithreading and parallelization programming, promoting high-performance applications.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Broad Ecosystem:<\/strong> Compatible with extensive standard libraries, tools like Maven, and various IDEs, meeting the needs of the modern developer.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"11_Novedades_de_Oracle_Java_SE_21_LTS\"><\/span>11. What&#039;s New in Oracle Java SE 21 LTS<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>This LTS release introduces improvements aimed at current development challenges:<\/p>\r\n<ul>\r\n<li>\r\n<p><strong>Performance Optimization:<\/strong> Improvements to JVM startup and application execution in both on-premises and cloud environments.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Language Refinements:<\/strong> Lambda expressions, <em>switch expressions<\/em> and <em>pattern matching<\/em> more powerful and concise, making it easier to write clear and efficient code.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>API Modernization:<\/strong> New features in collections, data processing, and network operations, integrating modern paradigms.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Innovations in Concurrency:<\/strong> The addition of Virtual Threads and improvements in parallelization enable the development of scalable, high-performance applications.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Enhanced Security:<\/strong> New authentication and encryption mechanisms strengthen protection against vulnerabilities.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"12_Aplicaciones_y_Proyectos_que_se_Pueden_Desarrollar_en_Java\"><\/span>12. Applications and Projects that Can be Developed in Java<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>Oracle Java SE 21 LTS is a versatile language that allows you to tackle a wide range of projects, such as:<\/p>\r\n<ul>\r\n<li>\r\n<p><strong>Business Applications:<\/strong> Management systems, CRMs and ERPs using frameworks such as Spring or Jakarta EE.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Web Applications:<\/strong> Development of RESTful websites and services using frameworks such as Spring Boot and JavaServer Faces (JSF).<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Desktop Applications:<\/strong> Complex tools and interfaces developed with JavaFX or Swing.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Mobile Applications:<\/strong> Although Android uses a modified version of Java, its ecosystem remains fundamental.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Microservices and Cloud Computing:<\/strong> Implementation of microservices-based architectures, ideal for cloud deployment.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Integrated Applications and IoT:<\/strong> Development of solutions for embedded devices or resource-limited environments.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Games and Multimedia Applications:<\/strong> From simple desktop games to advanced multimedia applications.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Big Data and Data Analysis:<\/strong> Java-based frameworks such as Apache Hadoop and Apache Spark facilitate the processing and analysis of large volumes of data.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<p>These possibilities demonstrate Java&#039;s versatility and its ability to respond to the needs of different sectors.<\/p>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"13_Programa_Explicativo_%C2%ABHola_Mundo%C2%BB_en_Java\"><\/span>13. Explanatory Program &quot;Hello World&quot; in Java<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>The following is the classic &quot;Hello World&quot; program, which illustrates the basic structure of an application in Oracle Java SE 21 LTS:<\/p>\r\n<p>java<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-java\" data-line=\"\" data-no-auto-translation=\"\">public class HolaMundo {\n    public static void main(String[] args) {\n        System.out.println(&quot;Hola Mundo&quot;);\n    }\n}<\/code><\/pre>\r\n<p><strong>Code Breakdown:<\/strong><\/p>\r\n<ul>\r\n<li>\r\n<p><strong>Class Definition:<\/strong> The public class is declared <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">HolaMundo<\/code>.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Main Method (<\/strong><code class=\"\" data-line=\"\" data-no-auto-translation=\"\">main<\/code><strong>):<\/strong> It is the entry point of the program, defined as <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">public\n\tstatic void main(String[] args)<\/code>.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Output to Console:<\/strong> The instruction <code class=\"\" data-line=\"\" data-no-auto-translation=\"\">System.out.println(&quot;Hola Mundo&quot;);<\/code> prints the message to the terminal.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<p><strong>To compile and run:<\/strong><\/p>\r\n<ol>\r\n<li>\r\n<p><strong>Compilation:<\/strong><\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">javac HolaMundo.java<\/code><\/pre>\r\n<\/li>\r\n<li>\r\n<p><strong>Execution:<\/strong><\/p>\r\n<p>bash<\/p>\r\n<pre data-no-auto-translation=\"\"><code class=\"language-bash\" data-line=\"\" data-no-auto-translation=\"\">java HolaMundo<\/code><\/pre>\r\n<\/li>\r\n<\/ol>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"14_Conclusiones\"><\/span>14. Conclusions<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>This chapter has laid the fundamental foundation for mastering Oracle Java SE 21 LTS. It has presented the language&#039;s philosophy and the principles of Object-Oriented Programming (OOP). It has detailed practical cases ranging from installing and configuring the JDK on different operating systems to the complete application development cycle (compilation, execution, debugging, and packaging into JAR files). It has also demonstrated Java&#039;s great versatility, allowing for the development of projects in diverse areas, from enterprise systems to Big Data and IoT applications.<\/p>\r\n<p>The JAR packaging example and using the debugger <em>jdb<\/em> They highlight the importance of understanding the internal flow of the program to efficiently detect and correct errors.<\/p>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"15_Resumen_del_Capitulo\"><\/span>15. Chapter Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<ul>\r\n<li>\r\n<p><strong>Philosophy and Foundations:<\/strong> Principles of robustness, security, and portability that underpin Oracle Java SE 21 LTS.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Installing and Configuring the JDK:<\/strong> Detailed guide for Windows 11, macOS, and MX\u2011Linux, with complete configuration of environment variables (JAVA_HOME, PATH, and optional CLASSPATH).<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Application Life Cycle:<\/strong> Process that covers from compilation and execution to debugging (<em>jdb<\/em>) and packaged into JAR files.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>What&#039;s New and Features:<\/strong> Performance improvements, language refinements, API modernization, concurrency innovations, and enhanced security.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Applications and Projects:<\/strong> Broad possibilities ranging from business and web applications to IoT, gaming, and Big Data.<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Practical Example:<\/strong> The \u201cHello World\u201d program exemplifies the basic development flow with Oracle Java SE 21 LTS.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"16_Referencias\"><\/span>16. References<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<ol>\r\n<li>\r\n<p><strong>Oracle Java Official Site:<\/strong> Official Oracle Java SE downloads and information:<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>OpenJDK:<\/strong> OpenJDK Project Documentation and Resources:<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>Apache Maven:<\/strong> Tutorials and documentation for Java project management:<\/p>\r\n<\/li>\r\n<\/ol>\r\n<h2 class=\"western\"><span class=\"ez-toc-section\" id=\"17_Mirada_Hacia_Adelante\"><\/span>17. Looking Ahead<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>With the foundations you&#039;ve learned in this chapter, you&#039;ll be ready to delve into more complex topics such as modular programming, continuous integration, automated deployment, and creating microservices in distributed environments. The experience you gain in configuring and managing JAR files, and mastering debugging and optimization techniques, will prepare you to tackle larger and more complex projects.<\/p>\r\n<p>If at any point a relevant section is identified as missing from this chapter, it will be dynamically integrated into future revisions to keep this guide complete and up-to-date.<\/p>\r\n<p>This revised and expanded document offers a comprehensive and detailed overview of the essential foundations of Oracle Java SE 21 LTS. This reference provides all the sections you need to begin your journey into the fascinating world of Java, and leaves room for future additions or expansions based on learning needs and technological developments.<\/p>\r\n<p>Welcome to the world of Oracle Java SE 21 LTS and a journey full of development, innovation, and discovery!<\/p>\r\n<p>&nbsp;<\/p>\n<div style='text-align:center' class='yasr-auto-insert-overall'><\/div><div style='text-align:center' class='yasr-auto-insert-visitor'><\/div>","protected":false},"excerpt":{"rendered":"<p>Curso de Oracle Java SE 21 LTS a Fondo En este primer cap\u00edtulo se establecen los fundamentos para trabajar con Oracle Java SE 21 LTS, la versi\u00f3n LTS respaldada por Oracle. Aqu\u00ed aprender\u00e1s sobre los or\u00edgenes e historia del lenguaje, su filosof\u00eda y la Programaci\u00f3n Orientada a Objetos (POO), hasta [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4620,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"jetpack_post_was_ever_published":false,"yasr_overall_rating":0,"yasr_post_is_review":"","yasr_auto_insert_disabled":"","yasr_review_type":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,176,2,265],"tags":[13,14,19],"class_list":["post-4563","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-desarrollo","category-desarrollo-web","category-informatica","category-java","tag-ide","tag-java","tag-mx-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Cap\u00edtulo 1: Introducci\u00f3n a la programaci\u00f3n en Oracle Java SE 21 LTS. | javiercachon.com<\/title>\n<meta name=\"description\" content=\"En este primer cap\u00edtulo se establecen los fundamentos para trabajar con Oracle Java SE 21 LTS, la \u00faltima edici\u00f3n respaldada por Oracle.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Cap\u00edtulo 1: Introducci\u00f3n a la programaci\u00f3n en Oracle Java SE 21 LTS. | javiercachon.com\" \/>\n<meta property=\"og:description\" content=\"En este primer cap\u00edtulo se establecen los fundamentos para trabajar con Oracle Java SE 21 LTS, la \u00faltima edici\u00f3n respaldada por Oracle.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/\" \/>\n<meta property=\"og:site_name\" content=\"javiercachon.com\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javiercachon82\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/javiercachon82\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-08T15:39:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-15T11:53:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/Oracle-Java-21-SE-with-MX-Linux-and-a-steaming-cup-of-coffee-at-1080p.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Javier Cach\u00f3n Garrido\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/x.com\/udegeek\" \/>\n<meta name=\"twitter:site\" content=\"@udegeek\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Javier Cach\u00f3n Garrido\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"17 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/javiercachon.com\\\/capitulo-1-programacion-en-oracle-java-se-21\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/javiercachon.com\\\/capitulo-1-programacion-en-oracle-java-se-21\\\/\"},\"author\":{\"name\":\"Javier Cach\u00f3n Garrido\",\"@id\":\"https:\\\/\\\/javiercachon.com\\\/es\\\/#\\\/schema\\\/person\\\/56ea56e1350676921cc43a3bcfd6c997\"},\"headline\":\"Cap\u00edtulo 1: Introducci\u00f3n a la programaci\u00f3n en Oracle Java SE 21 LTS.\",\"datePublished\":\"2025-05-08T15:39:36+00:00\",\"dateModified\":\"2025-05-15T11:53:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/javiercachon.com\\\/capitulo-1-programacion-en-oracle-java-se-21\\\/\"},\"wordCount\":3546,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/javiercachon.com\\\/es\\\/#\\\/schema\\\/person\\\/56ea56e1350676921cc43a3bcfd6c997\"},\"image\":{\"@id\":\"https:\\\/\\\/javiercachon.com\\\/capitulo-1-programacion-en-oracle-java-se-21\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/javiercachon.com\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/Oracle-Java-21-SE-with-MX-Linux-and-a-steaming-cup-of-coffee-at-1080p.jpg\",\"keywords\":[\"IDE\",\"Java\",\"MX-Linux\"],\"articleSection\":[\"Desarrollo\",\"Desarrollo Web\",\"Inform\u00e1tica\",\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/javiercachon.com\\\/capitulo-1-programacion-en-oracle-java-se-21\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/javiercachon.com\\\/capitulo-1-programacion-en-oracle-java-se-21\\\/\",\"url\":\"https:\\\/\\\/javiercachon.com\\\/capitulo-1-programacion-en-oracle-java-se-21\\\/\",\"name\":\"Cap\u00edtulo 1: Introducci\u00f3n a la programaci\u00f3n en Oracle Java SE 21 LTS. | javiercachon.com\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/javiercachon.com\\\/es\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/javiercachon.com\\\/capitulo-1-programacion-en-oracle-java-se-21\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/javiercachon.com\\\/capitulo-1-programacion-en-oracle-java-se-21\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/javiercachon.com\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/Oracle-Java-21-SE-with-MX-Linux-and-a-steaming-cup-of-coffee-at-1080p.jpg\",\"datePublished\":\"2025-05-08T15:39:36+00:00\",\"dateModified\":\"2025-05-15T11:53:58+00:00\",\"description\":\"En este primer cap\u00edtulo se establecen los fundamentos para trabajar con Oracle Java SE 21 LTS, la \u00faltima edici\u00f3n respaldada por Oracle.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/javiercachon.com\\\/capitulo-1-programacion-en-oracle-java-se-21\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/javiercachon.com\\\/capitulo-1-programacion-en-oracle-java-se-21\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/javiercachon.com\\\/capitulo-1-programacion-en-oracle-java-se-21\\\/#primaryimage\",\"url\":\"https:\\\/\\\/javiercachon.com\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/Oracle-Java-21-SE-with-MX-Linux-and-a-steaming-cup-of-coffee-at-1080p.jpg\",\"contentUrl\":\"https:\\\/\\\/javiercachon.com\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/Oracle-Java-21-SE-with-MX-Linux-and-a-steaming-cup-of-coffee-at-1080p.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/javiercachon.com\\\/capitulo-1-programacion-en-oracle-java-se-21\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"inicio\",\"item\":\"https:\\\/\\\/javiercachon.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cap\u00edtulo 1: Introducci\u00f3n a la programaci\u00f3n en Oracle Java SE 21 LTS.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/javiercachon.com\\\/es\\\/#website\",\"url\":\"https:\\\/\\\/javiercachon.com\\\/es\\\/\",\"name\":\"javiercachon.com\",\"description\":\"es una plataforma educativa revolucionaria que busca democratizar el acceso al conocimiento en inform\u00e1tica.\",\"publisher\":{\"@id\":\"https:\\\/\\\/javiercachon.com\\\/es\\\/#\\\/schema\\\/person\\\/56ea56e1350676921cc43a3bcfd6c997\"},\"alternateName\":\"javiercachon.com\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/javiercachon.com\\\/es\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/javiercachon.com\\\/es\\\/#\\\/schema\\\/person\\\/56ea56e1350676921cc43a3bcfd6c997\",\"name\":\"Javier Cach\u00f3n Garrido\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/javiercachon.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/Montanas-JC-logo-azul.jpg\",\"url\":\"https:\\\/\\\/javiercachon.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/Montanas-JC-logo-azul.jpg\",\"contentUrl\":\"https:\\\/\\\/javiercachon.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/Montanas-JC-logo-azul.jpg\",\"width\":250,\"height\":34,\"caption\":\"Javier Cach\u00f3n Garrido\"},\"logo\":{\"@id\":\"https:\\\/\\\/javiercachon.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/Montanas-JC-logo-azul.jpg\"},\"description\":\"Javier Cach\u00f3n Garrido es un experto en inform\u00e1tica, apasionado por el c\u00f3digo abierto y la educaci\u00f3n tecnol\u00f3gica. Como fundador de JavierCachon.com, impulsa la formaci\u00f3n en GNU\\\/Linux y software libre, promoviendo el aprendizaje accesible y colaborativo. Su misi\u00f3n es democratizar el conocimiento en TI, ofreciendo recursos gratuitos y de calidad para profesionales y entusiastas del sector. Es un profeta y predicador que evangeliza la tecnolog\u00eda, la inform\u00e1tica y telecomunicaciones, acomp\u00e1\u00f1ale en su aventura y pasi\u00f3n por los sistemas operativos abiertos GNU\\\/Linux.\",\"sameAs\":[\"https:\\\/\\\/javiercachon.com\\\/\",\"https:\\\/\\\/www.facebook.com\\\/javiercachon82\",\"https:\\\/\\\/www.instagram.com\\\/edugeek\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/javiercachongarrido\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/x.com\\\/udegeek\",\"https:\\\/\\\/www.youtube.com\\\/@edugeek\",\"https:\\\/\\\/wiki.javiercachon.com\\\/wiki\\\/index.php\\\/Usuario:Ojosdegato\"],\"url\":\"https:\\\/\\\/javiercachon.com\\\/en\\\/author\\\/ojosdegato\\\/\"},false]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Cap\u00edtulo 1: Introducci\u00f3n a la programaci\u00f3n en Oracle Java SE 21 LTS. | javiercachon.com","description":"En este primer cap\u00edtulo se establecen los fundamentos para trabajar con Oracle Java SE 21 LTS, la \u00faltima edici\u00f3n respaldada por Oracle.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/","og_locale":"en_US","og_type":"article","og_title":"Cap\u00edtulo 1: Introducci\u00f3n a la programaci\u00f3n en Oracle Java SE 21 LTS. | javiercachon.com","og_description":"En este primer cap\u00edtulo se establecen los fundamentos para trabajar con Oracle Java SE 21 LTS, la \u00faltima edici\u00f3n respaldada por Oracle.","og_url":"https:\/\/javiercachon.com\/en\/capitulo-1-programacion-en-oracle-java-se-21\/","og_site_name":"javiercachon.com","article_publisher":"https:\/\/www.facebook.com\/javiercachon82","article_author":"https:\/\/www.facebook.com\/javiercachon82","article_published_time":"2025-05-08T15:39:36+00:00","article_modified_time":"2025-05-15T11:53:58+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/Oracle-Java-21-SE-with-MX-Linux-and-a-steaming-cup-of-coffee-at-1080p.jpg","type":"image\/jpeg"}],"author":"Javier Cach\u00f3n Garrido","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/x.com\/udegeek","twitter_site":"@udegeek","twitter_misc":{"Written by":"Javier Cach\u00f3n Garrido","Est. reading time":"17 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/javiercachon.com\/capitulo-1-programacion-en-oracle-java-se-21\/#article","isPartOf":{"@id":"https:\/\/javiercachon.com\/capitulo-1-programacion-en-oracle-java-se-21\/"},"author":{"name":"Javier Cach\u00f3n Garrido","@id":"https:\/\/javiercachon.com\/es\/#\/schema\/person\/56ea56e1350676921cc43a3bcfd6c997"},"headline":"Cap\u00edtulo 1: Introducci\u00f3n a la programaci\u00f3n en Oracle Java SE 21 LTS.","datePublished":"2025-05-08T15:39:36+00:00","dateModified":"2025-05-15T11:53:58+00:00","mainEntityOfPage":{"@id":"https:\/\/javiercachon.com\/capitulo-1-programacion-en-oracle-java-se-21\/"},"wordCount":3546,"commentCount":0,"publisher":{"@id":"https:\/\/javiercachon.com\/es\/#\/schema\/person\/56ea56e1350676921cc43a3bcfd6c997"},"image":{"@id":"https:\/\/javiercachon.com\/capitulo-1-programacion-en-oracle-java-se-21\/#primaryimage"},"thumbnailUrl":"https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/Oracle-Java-21-SE-with-MX-Linux-and-a-steaming-cup-of-coffee-at-1080p.jpg","keywords":["IDE","Java","MX-Linux"],"articleSection":["Desarrollo","Desarrollo Web","Inform\u00e1tica","Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/javiercachon.com\/capitulo-1-programacion-en-oracle-java-se-21\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/javiercachon.com\/capitulo-1-programacion-en-oracle-java-se-21\/","url":"https:\/\/javiercachon.com\/capitulo-1-programacion-en-oracle-java-se-21\/","name":"Cap\u00edtulo 1: Introducci\u00f3n a la programaci\u00f3n en Oracle Java SE 21 LTS. | javiercachon.com","isPartOf":{"@id":"https:\/\/javiercachon.com\/es\/#website"},"primaryImageOfPage":{"@id":"https:\/\/javiercachon.com\/capitulo-1-programacion-en-oracle-java-se-21\/#primaryimage"},"image":{"@id":"https:\/\/javiercachon.com\/capitulo-1-programacion-en-oracle-java-se-21\/#primaryimage"},"thumbnailUrl":"https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/Oracle-Java-21-SE-with-MX-Linux-and-a-steaming-cup-of-coffee-at-1080p.jpg","datePublished":"2025-05-08T15:39:36+00:00","dateModified":"2025-05-15T11:53:58+00:00","description":"En este primer cap\u00edtulo se establecen los fundamentos para trabajar con Oracle Java SE 21 LTS, la \u00faltima edici\u00f3n respaldada por Oracle.","breadcrumb":{"@id":"https:\/\/javiercachon.com\/capitulo-1-programacion-en-oracle-java-se-21\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/javiercachon.com\/capitulo-1-programacion-en-oracle-java-se-21\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/javiercachon.com\/capitulo-1-programacion-en-oracle-java-se-21\/#primaryimage","url":"https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/Oracle-Java-21-SE-with-MX-Linux-and-a-steaming-cup-of-coffee-at-1080p.jpg","contentUrl":"https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/Oracle-Java-21-SE-with-MX-Linux-and-a-steaming-cup-of-coffee-at-1080p.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/javiercachon.com\/capitulo-1-programacion-en-oracle-java-se-21\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"inicio","item":"https:\/\/javiercachon.com\/"},{"@type":"ListItem","position":2,"name":"Cap\u00edtulo 1: Introducci\u00f3n a la programaci\u00f3n en Oracle Java SE 21 LTS."}]},{"@type":"WebSite","@id":"https:\/\/javiercachon.com\/es\/#website","url":"https:\/\/javiercachon.com\/es\/","name":"javiercachon.com","description":"It is a revolutionary educational platform that seeks to democratize access to computer science knowledge.","publisher":{"@id":"https:\/\/javiercachon.com\/es\/#\/schema\/person\/56ea56e1350676921cc43a3bcfd6c997"},"alternateName":"javiercachon.com","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/javiercachon.com\/es\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/javiercachon.com\/es\/#\/schema\/person\/56ea56e1350676921cc43a3bcfd6c997","name":"Javier Cach\u00f3n Garrido","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/javiercachon.com\/wp-content\/uploads\/2024\/11\/Montanas-JC-logo-azul.jpg","url":"https:\/\/javiercachon.com\/wp-content\/uploads\/2024\/11\/Montanas-JC-logo-azul.jpg","contentUrl":"https:\/\/javiercachon.com\/wp-content\/uploads\/2024\/11\/Montanas-JC-logo-azul.jpg","width":250,"height":34,"caption":"Javier Cach\u00f3n Garrido"},"logo":{"@id":"https:\/\/javiercachon.com\/wp-content\/uploads\/2024\/11\/Montanas-JC-logo-azul.jpg"},"description":"Javier Cach\u00f3n Garrido es un experto en inform\u00e1tica, apasionado por el c\u00f3digo abierto y la educaci\u00f3n tecnol\u00f3gica. Como fundador de JavierCachon.com, impulsa la formaci\u00f3n en GNU\/Linux y software libre, promoviendo el aprendizaje accesible y colaborativo. Su misi\u00f3n es democratizar el conocimiento en TI, ofreciendo recursos gratuitos y de calidad para profesionales y entusiastas del sector. Es un profeta y predicador que evangeliza la tecnolog\u00eda, la inform\u00e1tica y telecomunicaciones, acomp\u00e1\u00f1ale en su aventura y pasi\u00f3n por los sistemas operativos abiertos GNU\/Linux.","sameAs":["https:\/\/javiercachon.com\/","https:\/\/www.facebook.com\/javiercachon82","https:\/\/www.instagram.com\/edugeek\/","https:\/\/www.linkedin.com\/in\/javiercachongarrido\/","https:\/\/x.com\/https:\/\/x.com\/udegeek","https:\/\/www.youtube.com\/@edugeek","https:\/\/wiki.javiercachon.com\/wiki\/index.php\/Usuario:Ojosdegato"],"url":"https:\/\/javiercachon.com\/en\/author\/ojosdegato\/"},false]}},"yasr_visitor_votes":{"stars_attributes":{"read_only":false,"span_bottom":false},"number_of_votes":0,"sum_votes":0},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/javiercachon.com\/wp-content\/uploads\/2025\/05\/Oracle-Java-21-SE-with-MX-Linux-and-a-steaming-cup-of-coffee-at-1080p.jpg","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/javiercachon.com\/en\/wp-json\/wp\/v2\/posts\/4563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/javiercachon.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/javiercachon.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/javiercachon.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/javiercachon.com\/en\/wp-json\/wp\/v2\/comments?post=4563"}],"version-history":[{"count":0,"href":"https:\/\/javiercachon.com\/en\/wp-json\/wp\/v2\/posts\/4563\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/javiercachon.com\/en\/wp-json\/wp\/v2\/media\/4620"}],"wp:attachment":[{"href":"https:\/\/javiercachon.com\/en\/wp-json\/wp\/v2\/media?parent=4563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/javiercachon.com\/en\/wp-json\/wp\/v2\/categories?post=4563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/javiercachon.com\/en\/wp-json\/wp\/v2\/tags?post=4563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}