Scala: How to add Jar files and classes to the REPL Classpath

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is a short recipe, Recipe 14.3, “How to add Jar files and classes to the REPL Classpath.”


You want to add individual classes or one or more JAR files to the REPL classpath so you can use them in a REPL session.

Android Studio - How to import a jar file (in a libs folder)

I just started using Android Studio 1.x and quickly ran into a problem where I needed to use a Jar file in my Android project. In short, this image shows the steps I followed to import the Jar file into my project. As an important note, I put the Jar file I needed in an app/libs folder, which I created in my project. As the image shows, this affects your Gradle build configuration. (I found this info at this SO link.)

How to run a Scala application in a jar file while setting the classpath

I don’t know why, but without digging into it more, all I can say right now is that I can’t use the Java Sound API from within SBT. Whenever I try running sbt run, I keep getting the following error message, even though I know that my app and sound file work fine when I package my Java application normally:

javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file

As part of the debugging process I created a little shell script named run.sh that contained these two lines:

How to add a new jar file to the Scala REPL classpath (interactive command line)

Scala REPL FAQ: How do I add a Jar file to the Scala REPL classpath? (The Scala REPL is the interactive command line you get if you just type scala at your command line.)

To add a new jar file to the Scala REPL classpath (interactive command line classpath), use the :require command at the command line, like this:

scala> :require myjar.jar

Where are Java WebStart files kept on Mac OS X 10.6?

Mac Java WebStart FAQ: Where are Java WebStart files (Jar files) kept on Mac OS X systems? And how can I delete WebStart apps on a Mac?

Java WebStart Jar files are kept below this directory on Mac OS X 10.6:


More than likely you're asking because you want to delete these Java WebStart files on your Mac. The easiest way to delete them is: