9. Host Platform Interoperability with Java and JavaScript
Overview
In this chapter, we will look at interoperability between Clojure and both Java and JavaScript. Clojure runs on top of platforms provided by Java and JavaScript. Clojure was designed to use libraries provided by Java or JavaScript. We will learn how to access Java and JavaScript objects and methods in Clojure. We will also learn how to convert data between Clojure and Java or JavaScript and back. After learning how to access Java and JavaScript from Clojure, we will investigate how to perform Input-Output (I/O) operations like reading and writing to files using Java classes. We will then learn how to deal with errors and exceptions in our code.
By the end of this chapter, you will be able to work with the appropriate syntax and semantics to access Java and JavaScript objects and methods from Clojure, and deal with Java exceptions and JavaScript errors.