Understand the JVM so you can ❤️ Clojure

The number of undefined terms in documentation can be infuriating. What is a CLASSPATH? What's PermGen? Do you get lost in the massive standard library? Have you ever given up on an exception because you were crushed under the weight of the stack traces? Do you hate using Java directly instead of a nice Clojure wrapper? The number of things to learn just to start using Clojure is enormous.

The truth is, the JVM is a big, complicated system that has evolved over time. Clojure sits on top of it like a rider on a horse. When a Java programmer gets into Clojure, it's all gravy. They already know the ins and outs of Java and the JVM, so to have a sweet language like Clojure to control it, they squeal with joy. But if you don't have that JVM experience, the squeals are not joyful. It is definitely confusing.

Wouldn't it be nice to skip 10 years of Java experience and see what the experts see?

Sure, you're not going to become an expert overnight. That's not what I'm talking about. However, some of the concepts are more important than others. In fact, the stuff that a Clojure programmer needs to use most days is quite small. If you learn just those, you'll be playing on easy mode. Further, you can learn the tricks experienced Java people use to find out what they don't know. It's often as easy as googling the error message.

Introducing JVM Fundamentals for Clojure

This course teaches you the hands-on, nitty gritty details of the JVM and Clojure/Java interop that you would pick up after many years of programming Java. It combines videos with reference sheets to give you easy access to the accumulated skills of years of experience. With this course, you won't have to worry about stack traces, JVM options, or the standard library again.

Topics covered:

  • Calling methods and accessing fields.
  • Class and method introspection.
  • Reading Javadocs.
  • Handling and raising errors and exceptions.
  • Manipulating Java arrays.
  • Dealing with dates and times.
  • Understanding the classpath.
  • The anatomy of a JAR
  • Controlling JVM memory usage.
  • Running java and Clojure programs from the command line.
  • Doing I/O on the JVM
  • Helpful macros for manipulating stateful objects

What people are saying

"I just wanted to say thank you for making a lesson out of my suggestion. I watched it today and think it is really excellent.

"JVM Fundamentals is really a jewel of learning material. Congratulations and thanks for your great work."

Jorge Duenas

Jorge Duenas

"I can't overstate the importance of your courses on JVM, namespacing, and lein. I know they're much drier and not as "sexy" as the FP courses but as the tech lead and architect for our systems (we're a Python/JavaScript shop but I've been salivating over clojure/cljs for awhile) my lack of understanding of those topics has been the major hurdle for me adopting the language for major products, since if anything goes wrong it's my head on the chopping block. It's something I could learn on my own but time is super precious. These courses have given me the confidence to greenlight the adoption of Clojure. From a senior engineer perspective they're way more important than the "how to program" courses (although I enjoy those too)."

James Tolton

James Tolton

Want this course?

Team License

$499
  • HD Download
  • Watch Online
  • Lifetime Access
  • For your company

Download License

$75
  • HD Download
  • Watch Online
  • Lifetime Access
  • For an individual

Online License

$48
  • Watch Online
  • Lifetime Access
  • For an individual

Membership

$49/mo
  • HD Downloads
  • Watch Online
  • Full access
  • All Content
  • For an individual
Get access

Love it or leave it guarantee

If you don't learn as much from this course as you thought, just ask for a refund within 30 days and I'll give you your money back.

JVM Fundamentals for Clojure

Lessons

Video time: 05h07m

JVM JRE JDK
  • 5 min

Ever get confused with what the JVM, JRE, and JDK are and what are in them? This lesson runs through these abbreviations. They're actually easier than they sound.

Different JDKs
  • 5 min

There are many JDKs. Oracle JDK, Open JDK, and many others.

Javadocs
  • 11 min

This lesson goes over the structure of the Javadocs and some tricks for making the most of them.

Java Dependencies
  • 14 min

Java has had a way to package compiled code and resources and share them around since almost the beginning. It's called the JAR (Java Archive). Combine that with a artifact, versioning, and dependency management system (called Maven), and we have a complete dependency management system.

Leiningen and Dependencies
  • 18 min

Leiningen hooks into the Maven dependency management to provide dependencies for Clojure. We take a look at how Leiningen does that. We also see how to 1) find conflicts in the dependencies; and 2) find old dependencies that can be upgraded.

Boot and Dependencies
  • 8 min

Learn how to manage Clojure dependencies using Boot.

Running Java with options
  • 12 min

This lesson goes over some of the most common commands for running java on the command line.

Fields and Methods
  • 8 min

Everything in Clojure is based on Java Objects. That means it all boils down to methods and fields on objects and classes. When you're interfacing with a Java library, including the standard library, you will need to access methods and fields all the time. This lesson covers the normal and most common ways of calling methods and accessing/changing the state of objects.

Classes and Reflection
  • 11 min

Java has a good story for reflection: just ask the object for its class and ask the class for a list of methods. Voilà! You know what methods you can call. This lesson demonstrates reflection with some examples.

Import form
  • 9 min

When we need to refer to Java classes, we need to import them in the ns declaration. There are a few things you should know about doing that. This lesson covers the basics, a couple of gotchas, and some nice properties of the import form.

Exceptions and Errors
  • 11 min

In this lesson, I go through throwing, catching, and extracting information from exceptions and errors.

Java Arrays
  • 15 min

Every now and then you'll have to use Java arrays. Usually it's because a method returns an array. But sometimes you'll have to create one. This lesson goes over just that--consuming and creating Java arrays in Clojure.

Java I/O
  • 20 min

In this video, we go over some common patterns for using the java.io package and how the clojure.java.io namespace handles the most common cases for you.

Files
  • 11 min

In this lesson we look at java.io.File and how the clojure.java.io namespace makes it easy to use.

Monitoring Tools
  • 14 min

We look at several tools for querying the JVM so that we can monitor it.

Cloud Monitoring
  • 4 min

If you're running a system in production, you'll want to keep an eye on it 24 hours per day. There are now cloud monitoring options that collect information from your JVM all the time and will send alerts.

Creating a Clojure Library for use in Java
  • 18 min

Have you ever wanted to solve a problem with your Java app by using Clojure? Have you ever wanted to "sneak in" a dependency on the Clojure JAR but didn't know what to do with it once it was there? This lesson shows you how to create a Clojure library that you can use from Java.

JAR Anatomy
  • 15 min

Like a surgeon, we dissect JAR files to figure out how they tick. We also take a look at the jar command and how to use it to create, extract, and update JAR files.

Creating JARs with Leiningen
  • 6 min

We learn how to create JARs and UberJARs with Leiningen.

Creating JARs with Boot
  • 5 min

We learn how to create JAR files with Boot.

Java Threads
  • 14 min

We look at creating and starting threads on the JVM and how to cleanly shut everything down.

Dealing with temporary files
  • 10 min

Creating temporary files on the JVM is not hard, per se, but it is not obvious, either. It's done with a very Java-esque style. In this lesson, we go through how to create a temporary file and how to create a temporary directory.

Logging on the JVM
  • 18 min

A lot of people requested this lesson. How do we set up logging on the JVM? It turns out that it's not that hard. We can do it with a few lines of code. In this lesson, we see how to use logging in libraries and in applications.

Creating Java classes with gen-class
  • 29 min

Clojure comes with a set of tools for creating Java classes (compiled to .class files) using pure Clojure. It's called gen-class. You can add :gen-class directives to your namespace declarations.

Creating Java interfaces with gen-interface
  • 3 min

Clojure comes with a tool called gen-interface for building Java interfaces without writing any Java. We look at how to make a new interface including defining its methods.

Mixed projects (Clojure with some Java)
  • 4 min

Despite having gen-class and gen-interface, sometimes you need to write some Java. In this lesson, we see how to integrate Java source files into Leiningen and Boot projects.

Clojure compiler options
  • 10 min

The Clojure compiler has a few options that can speed up the execution of generated code at the expense of dynamism.