Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Introduction to JVM Languages
  • Table Of Contents Toc
  • Feedback & Rating feedback
Introduction to JVM Languages

Introduction to JVM Languages

By : van der Leun
close
close
Introduction to JVM Languages

Introduction to JVM Languages

By: van der Leun

Overview of this book

Anyone who knows software development knows about the Java Virtual Machine. The Java Virtual Machine is responsible for interpreting Java byte code and translating it into actions. In the beginning, Java was the only programming language used for the JVM. But increasing complexity of the language and the remarkable performance of the JVM created an opening for a new generation of programming languages. If you want to build a strong foundation with the Java Virtual Machine and get started with popular modern programming languages, then this book is for you. The book will begin with a general introduction of the JVM and its features, which are common to the JVM languages, helping you get abreast with its concepts. It will then dive into explaining languages such as Java, Scala, Clojure, Kotlin, and Groovy and will show how to work with each language, their features, use cases, and pros and cons. By writing example projects in those languages and focusing on each language’s strong points, it will help you find the programming language that is most appropriate for your particular needs. By the end of the book, you will have written multiple programs that run on the Java Virtual Machine and know about the differences between the various languages.
Table of Contents (15 chapters)
close
close

What this book covers

Chapter 1, Java Virtual Machine, provides a high-level overview of the Java platform and the Java Virtual Machine (JVM). It describes popular use cases for applications running on the JVM, namely web applications, big data analysis, and Internet of Things (IoT). Also covered are important JVM concepts, including its just-in-time compiler, type system, and garbage collector.

Chapter 2, Developing on the Java Virtual Machine, explains the JVM in more technical detail. Covered are both the installation procedure and organization of the Java Development Kit (JDK) on major operating systems (Windows, macOS, and Linux). Also explained is the organization of the Java Class Library and instructions on how to run JVM-based applications by setting up the ClassPath.

Chapter 3, Java, covers the fundamentals of the Java language. It covers creating classes and instantiating objects based on these classes, adding methods and properties to classes, and Java's access modifiers and other modifiers. Some of the other concepts that are discussed include abstract classes, interfaces, arrays, and collections and exceptions. More advanced features such as threading and lambdas are covered as well.

Chapter 4, Java Programming, contains a step-by-step guide to creating a simple web service in the Java language. Tools that are used along the way include the Eclipse IDE, the Gradle build tool, and programming libraries such as SparkJava (a micro web service framework) and the JUnit unit testing framework.

Chapter 5, Scala, talks about the hybrid functional programming and object-oriented programming language Scala. It describes the installation procedure and the usage of the interactive shell bundled with the language. By using the interactive shell, Scala code can be entered and executed dynamically, without explicitly compiling code. Both object-oriented and functional programming in Scala are discussed.

Chapter 6, Scala Programming, contains a step-by-step guide to create a simple console-based application powered by the popular Akka toolkit. Akka is a toolkit specializing in writing scalable applications that take full advantage of modern multicore processors. Many Akka concepts, such as its actor-based system, are discussed thoroughly. To build the project, the Scala Build Tool (SBT) is used, while the ScalaTest library is used for writing unit tests.

Chapter 7, Clojure, explains the fundamentals of Clojure, a dynamic functional programming language inspired by Lisp, which is not object-oriented. Like Scala, Clojure comes with an interactive shell that can be used to enter the various examples that are provided. Agents, a technique to handle state in multithreading applications, are discussed as well.

Chapter 8, Clojure Programming, provides step-by-step guides for two smaller projects. One project is based on monads, a technique that is commonly used in functional programming languages, especially in Lisp. The second project is a web application that is powered by Luminus, a popular micro web framework for Clojure. The Leiningen build tool is used to build both the projects.

Chapter 9, Kotlin, discusses JetBrain's statically typed programming language, Kotlin. Kotlin's type system, which promises null safety, is explained. Other features that are discussed include data classes, lambdas, and inline functions. Procedural programming in Kotlin is covered as well.

Chapter 10, Kotlin Programming, contains a step-by-step guide to create a GUI-based desktop application using the JavaFX toolkit. Apache Maven is used to build the project. The Eclipse IDE's debugger is used to find and fix bugs.

Chapter 11, Groovy, covers the dynamic programming language Groovy, one of the first alternative languages that appeared on the JVM. While Groovy is primarily a dynamic language, it allows compiling statically typed code as well. Both use cases are explained and described in this chapter. Also explored is the Groovy Development Kit, an extensive library of built-in classes, which is distributed as part of the Groovy language distribution.

Chapter 12, Groovy Programming, provides a step-by-step guide to create a web service in Groovy that pulls data from an embedded database management system using the Java Database Connectivity (JDBC) standard and generates XML using classes from the Groovy Development Kit. The Vert.x framework is used to power the web service.

Appendix A, Other JVM Languages, covers five other JVM-based languages, often dialects of mainstream languages: Oracle Nashorn (JavaScript), Jython (Python), JRuby (Ruby), Frege (Haskell), and Ceylon, a statically typed language by Red Hat.

Appendix B, Quiz Answers, gives the solutions to quizes provided at the end of all the chapters.

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY