

I learned about the Scala REPL :require command by looking at the help from within the REPL. I usually find that I need to add a jar file to the Scala REPL after I've been running the REPL, but if you happen to know that you're going to need to add a jar file to the classpath when you start the interpreter, you can do so like this:Īs you can see, this approach uses the usual "-cp" classpath option that is used by the scalac and javac commands. Adding a jar file to the classpath when you start the Scala interpreter Your new classpath is: ".:/Users/Al/tests/myjar.jar"Īt this time you can begin using the classes in your jar (though you'll have to import them, as usual). You can get into a REPL on (OS X or Linux) from your terminal, from two different commands. 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:Īfter you do this, you should see a reply from the REPL like this:Īdded '/Users/Al/tests/myjar.jar'. 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.)

The cookie is used to store the user consent for the cookies in the category "Analytics". The editor shows sample boilerplate code.

Getting started with the OneCompiler's Scala compiler is simple and pretty fast. It's one of the robust, feature-rich online compilers for Scala language, running on the latest version 2.13.8.
SCALA REPL CODE
This cookie is set by GDPR Cookie Consent plugin. Write, Run & Share Scala code online using OneCompiler's Scala online compiler for free. These cookies ensure basic functionalities and security features of the website, anonymously. For quick access, add scala and scalac to your path. Start the Scala compiler by launching scalac from where it was unarchived. Start the Scala interpreter (aka the REPL) by launching scala from where it was unarchived.
SCALA REPL DOWNLOAD
Necessary cookies are absolutely essential for the website to function properly. Replit is the best tool for quickly starting, sharing, and developing projects in any programming language, right from your browser. To run Scala from the command-line, download the binaries and unpack the archive. While the Scala REPL provides an excellent venue for experimenting with the language's features, writing more than a line or two of code in it can be.
