Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Introduction to JVM Languages
Introduction to JVM Languages

Introduction to JVM Languages: Get familiar with the world of Java, Scala, Clojure, Kotlin, and Groovy

Arrow left icon
Profile Icon van der Leun
Arrow right icon
€8.99 €29.99
eBook Jun 2017 450 pages 1st Edition
eBook
€8.99 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon van der Leun
Arrow right icon
€8.99 €29.99
eBook Jun 2017 450 pages 1st Edition
eBook
€8.99 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€8.99 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Introduction to JVM Languages

Developing on the Java Virtual Machine

In this chapter, we will take an in-depth look at a Java Virtual Machine (JVM). We will focus on concepts that every JVM developer should know, regardless of the chosen programming language. This is what we will cover in this chapter:

  • Java Development Kit (JDK)
  • Class organization with packages
  • Java Class Library
  • Running JVM applications on the command line
  • Installing the Eclipse Integrated Development Environment (Eclipse IDE)

While this book covers Windows, macOS, and Linux (Ubuntu) operating systems, paths will often be shown in Windows style only. When using macOS and Linux systems, be sure to rewrite the paths using the rules of your operating system.

JDK

Developers who want to develop on a JVM should always install JDK. It bundles the Java Runtime Environment (JRE), the Java compiler, and various development tools, some of which we will explore in this chapter. Even if you are planning to do most of your JVM development in a language other than Java, it is strongly advised that you still install the complete JDK. Many prominent development tools require a fully installed JDK to run. Also, sooner or later, you'll probably want to use some of the tools that are only included in JDK.

The recent version of the Linux distribution of the Raspberry Pi installs the Java SE Embedded 8 JDK automatically when using the default Raspian installation options. Be aware though that, often, the supplied version is not up-to-date. We are not aware of other major operating systems that bundle JDK with their default installation. We will...

Class organization with packages

All JVM languages define their own syntaxes for creating classes and instantiating objects, but in the end, they produce class files that would run on the JVM. In order to be able to run on the JVM and be able to offer interoperability with classes written in other languages on the JVM platform, they have to follow JVM's requirements for organizing classes. We'll discuss the following topics:

  • Packages
  • Choosing a package
  • Package examples
  • Fully qualified class names
Knowledge of packages is required to understand the organization of the Java Class Library and how to run JVM applications on the command line. Both these topics are discussed in this chapter.

What are packages?

Most languages...

Java Class Library

The Java Class Library is also simply known as the Java API. It's a huge collection of prebuilt classes that is distributed with the Java SE platform. Some of the more important themes of the library include:

  • Definitions and implementations of common data structures
  • Console I/O
  • File I/O
  • Mathematics
  • Networking
  • Regular expressions
  • XML creation and processing
  • Database access
  • GUI toolkits
  • Reflection

We cannot cover the complete Java Class Library here, but we want to give some examples of the APIs that are available and give you pointers on where to find the classes you need. Before we look at specific classes, we will take a look at the main organization. We'll cover the following topics:

  • Java Class Library organization
  • Package overview
  • Fundamental classes from the java.lang package
  • Collections API, namely java.util.ArrayList and java.util.HashMap
  • ...

Running JVM applications on the command line

Running applications on a JVM is often considered a fairly complex topic. As mentioned in the previous chapter, compilers that target a JVM compile their source code to binary files with a .class file extension. There are a few rules that must be followed before you can have a JVM instance run the code inside the .class files:

  • At least one class must have a static main() method
  • All the class files should be stored in specific directories
  • The ClassPath has to be specified
  • Class files can optionally be placed inside a JAR archive container
  • To run the program, the java command is used

We will take a quick look at each rule. Then, to demonstrate these concepts as clearly as possible, we will be doing a hands-on demonstration project in Java.

...

Eclipse IDE

As we have seen in the previous section, using a simple text editor to create JVM programs can be a quite cumbersome process. In some languages, including Java, you'll have to make sure that the package name structure matches the directory structure of the source code. As we will soon see, there are more rules that some languages impose on the developer. Java requires that the source code filename should match the corresponding class name. Also, you have to manually specify the ClassPath when running programs. The list goes on.

In the JVM world, most programmers use the sophisticated IDE to develop their projects. Both commercial and open source IDEs that support the JVM concept are available on the market. Java support is extremely strong on all popular IDEs. Java programmers can expect the following features in a modern IDE:

  • First is the autocompletion feature...

JDK


Developers who want to develop on a JVM should always install JDK. It bundles the Java Runtime Environment (JRE), the Java compiler, and various development tools, some of which we will explore in this chapter. Even if you are planning to do most of your JVM development in a language other than Java, it is strongly advised that you still install the complete JDK. Many prominent development tools require a fully installed JDK to run. Also, sooner or later, you'll probably want to use some of the tools that are only included in JDK.

The recent version of the Linux distribution of the Raspberry Pi installs the Java SE Embedded 8 JDK automatically when using the default Raspian installation options. Be aware though that, often, the supplied version is not up-to-date. We are not aware of other major operating systems that bundle JDK with their default installation. We will cover the following JDK-related topics:

  • Installing JDK (Windows, macOS, and Linux)
  • Exploring JDK
  • JRE

Installing JDK

We will...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • This guide provides in-depth coverage of the Java Virtual Machine and its features
  • Filled with practical examples, this book will help you understand the core concepts of Java, Scala, Clojure, Kotlin, and Groovy
  • Work with various programming paradigms and gain knowledge about imperative, object-oriented and functional programming

Description

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.

Who is this book for?

This book is meant for programmers who are interested in the Java Virtual Machine (JVM) and want to learn more about the most popular programming languages that can be used for JVM development. Basic practical knowledge of a modern programming language that supports object-oriented programming (JavaScript, Python, C#, VB.NET, and C++) is assumed.

What you will learn

  • Gain practical information about the Java Virtual Machine
  • Understand the popular JVM languages and the Java Class Library
  • Get to know about various programming paradigms such as imperative, object-oriented, and functional
  • Work with common JVM tools such as Eclipse IDE, Gradle, and Maven
  • Explore frameworks such as SparkJava, Vert.x, Akka and JavaFX
  • Boost your knowledge about dialects of other well-known programming languages that run on the JVM, including JavaScript, Python, and Ruby

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 28, 2017
Length: 450 pages
Edition : 1st
Language : English
ISBN-13 : 9781787126589
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jun 28, 2017
Length: 450 pages
Edition : 1st
Language : English
ISBN-13 : 9781787126589
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 133.97
Introduction to JVM Languages
€36.99
Learning Functional Data Structures and Algorithms
€36.99
Clojure: High Performance JVM Programming
€59.99
Total 133.97 Stars icon
Banner background image

Table of Contents

14 Chapters
Java Virtual Machine Chevron down icon Chevron up icon
Developing on the Java Virtual Machine Chevron down icon Chevron up icon
Java Chevron down icon Chevron up icon
Java Programming Chevron down icon Chevron up icon
Scala Chevron down icon Chevron up icon
Scala Programming Chevron down icon Chevron up icon
Clojure Chevron down icon Chevron up icon
Clojure Programming Chevron down icon Chevron up icon
Kotlin Chevron down icon Chevron up icon
Kotlin Programming Chevron down icon Chevron up icon
Groovy Chevron down icon Chevron up icon
Groovy Programming Chevron down icon Chevron up icon
Other JVM languages Chevron down icon Chevron up icon
Quiz Answers Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.