From the course: Learning JVM Languages: JVM, Java, Scala

Why develop on JVM?

- [Instructor] Hello. Welcome to the section Java Virtual Machine. We'll cover these topics here. Reasons for developing on JVM, popular use cases of JVM, introducing JVM concepts, Java editions, other languages on JVM. Now we'll move on to the first video of this section, why develop on JVM? In this video, we're going to take a look at the Java Class Library and ecosystem. We'll then look at scenarios of creating a web application. With so many programming languages and platform options available today, why would you consider developing and deploying your next project on JVM? After all, Java, the language that JVM was originally built for, has been declared obsolete by fans of different languages more times over the years then anyone cares to remember. Yet, while many other programming languages have come in and gone out of the spotlight, Java has always managed to return to impressive spots, either near, or likely even on top of the list of the most used languages in the world. Let's look at some of the most important reasons why the JVM platform is so strong. It keeps up with the modern times by adapting to market changes. The Java Class Library, the built-in library of classes, is very strong. It has unmatched ecosystem. Now let's learn about the Java Class Library. For each edition of Java, it's been decided which classes are guaranteed to be available in a JVM implementation of a specific version. The Java Class Library for Java SE 8 is a very large collection of classes, and every JVM runtime installation that adheres to the Java SE 8 platform standard must implement those classes, regardless of the vendor of the JVM implementation. Classes in this library provide functionalities, such as writing or reading from the console window, performing file input-output, and communicating with TCP servers. Also, there are many classes available to start and manage operating system threads. More fundamentally, it contains classes that define data structures, such as lists and maps, among many others. The Java Class Library is an important reason why language developers love targeting JVM. Using the data structures defined in the Java Class Library, they're able to focus more on the language design and less on building a full runtime library from scratch. Building a fully tested multi-platform runtime system library comparable to a Java Class Library is a huge undertaking. Let's get to know the ecosystem now. A built-in class library can obviously not cover all the use cases of a programmer. If something is missing, you can turn to libraries and tools built by other companies, groups, and individuals to save time. Because Java has been so successful for many years, its ecosystem is unmatched. It will be hard to find a platform with proven high-quality tools, libraries, toolkits, and framework choices that are better than the ones available in JVM. With so many add-on libraries available, Java hardly ever pushes the developer in a certain direction. As an example of how rich the ecosystem is, let's look at the main options JVM developers typically have when creating a web application. First is building a web application that runs inside a JVM application server. To quickly have results, a general high-level web framework can be used. For more control, the application can be built with a microservice framework. So, let's look at scenario one, using a JVM application server. Developers could take the enterprise route and install a JVM-based application server, either a free open source one or a pay per priority one that will run the application along with the web application simultaneously if desired. The server will handle configuration issues and manage database connections. There are simple application servers available that just contain enough built-in APIs to run basic web applications, but there are also full-blown Oracle certified application servers that have a magnitude of built-in and standardized APIs, including APIs to access databases, generate or consume XML or JSON documents, communicate with other web services via the SOAP or REST standards, provide web security, send or receive messages from legacy computer systems, and many others. The two most important frameworks for enterprise development are Oracle's Java Enterprise Edition, Java EE platform, the Spring framework ecosystem, including Spring Boot. Many applications use both these technologies together. Some of the popular application servers are Apache Tomcat, for basic web applications, Apache TomEE, Red Hat WildFly, Oracle GlassFish, Red Hat JBoss Enterprise Application Platform, and Oracle WebLogic. The first four are open source, and the last two per priority. Our second scenario is using a general high-level web application framework. The second possibility would be to use a complete web application framework. These frameworks usually offer higher-level APIs and enterprise frameworks, and offer built-in model-view-controller MVC solutions that have the capability to enhance a developer's productivity significantly. Frameworks such as these usually dictate or steer the developer in a certain direction, as they have built-in support for only a few hard-coded libraries or toolkits. By giving up some freedom, quick development cycles can be achieved. Some frameworks require that the application is run inside a JVM application server, while other frameworks provide their own HTTP server. Apache Struts used to be very popular in this category, but nowadays, the Play framework is probably the most popular choice. The final scenario is using a microservice framework. A different choice could be to create the application using the modern microservice framework. Frameworks such as these have a built-in HTTP server to run your application, but they do not provide any other tools or libraries out of the box. In this scenario, it's easier to mix-and-match other libraries and toolkits that you want to use yourself. Commonly, the application will be separated into multiple standalone web services to follow the modern microservice architecture, but this is not a strict requirement of these frameworks. Vert.x and Spark Java are the most commonly used microservice frameworks. In this video, we've learnt the importance of JVM. In the next video, we'll look at popular use cases.

Contents