O'Reilly logo

Pragmatic Scala by Venkat Subramaniam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 14Intermixing with Java

A few powerful Scala libraries are out there and more are being developed. Not only can you use these libraries from Scala, you can use them from Java as well. But to do so you have to learn a few tricks.

In this chapter, you’ll learn how to use Java classes from Scala and use Scala classes from Java. You can easily intermix Scala code with code written in Java and other languages on the JVM. Scala compiles into bytecode and you can package the generated class files into a JAR. Thus, you can use the generated bytecode from your Java and Scala applications. Make sure that the scala-library.jar file’s in your classpath, and you’re all set.

You’ll learn how Scala idioms manifest on the Java side. Knowing this, you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required