This is usually not recommended, as most jar libraries are designed to be used with programmer projects. In addition, unlike other ecosystems, jar libraries are usually installed using some user-mode library management tool such as ivy or maven or sbt , as you may have noticed.
If you really want to do this, you can install the banks in the scala TOOL_CLASSPATH location, which you can find in the scala.bat or scala shell script file that comes with your scala distribution. In addition, you can create your own scala repl, which can load globally installed libraries from a specific configured location. In any case, it requires futzing with TOOL_CLASSPATH .
PS: I currently do not have access to the actual scala.bat file to help you with this, but you can find it here and here to understand what I mean. Please note that these files may not show how the .bat files are structured, as in the distribution (and can be quite dated). Please see it in the official distribution for information.
EDIT
I can explain a little more that I came back and looked at the actual scala batch and command scripts included in the official distribution :-)
As I said above, the scala script loads all the jar files present in the TOOL_CLASSPATH folder, which is usually ${SCALA_HOME}/lib . It also offers the option to add TOOL_CLASSPATH with the promising -toolcp option. See what it shows: (the batch version of the script is similar - I will just show things from the scala shell script).
while [[ $# -gt 0 ]]; do case "$1" in -D*) # pass to scala as well: otherwise we lose it sometimes when we # need it, eg communicating with a server compiler. java_args=("${java_args[@]}" "$1") scala_args=("${scala_args[@]}" "$1") shift ;; -J*) # as with -D, pass to scala even though it will almost # never be used. java_args=("${java_args[@]}" "${1:2}") scala_args=("${scala_args[@]}" "$1") shift ;; -toolcp) TOOL_CLASSPATH="${TOOL_CLASSPATH}${SEP}${2}" shift 2 ;; -nobootcp) unset usebootcp shift ;; -usebootcp) usebootcp="true" shift ;; -debug) SCALA_RUNNER_DEBUG=1 shift ;; *) scala_args=("${scala_args[@]}" "$1") shift ;; esac done
As you can see, this is very limiting - you need to specify each jar to be added. You can just use -cp ! Can we make it better? Of course, in this toolcp business we will have to extinguish.
addtoToolCP() { for i in $(find $1 -name "*.jar") do if [[ -z "$TOOLCP" ]] then TOOLCP="$i" else TOOLCP="${TOOLCP}:$i" fi done }
So, you can simply check the emptiness of our toolcp parameter and call scala accordingly as scala -toolcp $TOOLCP if it is not empty. Now you can just call your shell script like: myscalascript <list-of-paths-to-be-added-to-toolcp> . Or you can just save one folder and continue adding new libraries to this folder. Hope this helps, as others have said, to keep track of binary compatibility issues . Binary incompatibility issues will affect only major versions of scala, minor versions should be fully compatible. Finally, at the risk of repeating to death, use this only if you are sure you want this. :-)