Include jar file in Scala interpreter

后端 未结 7 1128
囚心锁ツ
囚心锁ツ 2020-12-28 14:54

Is it possible to include a jar file run running the Scala interpreter?

My code is working when I compile from scalac:

scalac script.scala -classpath         


        
7条回答
  •  南笙
    南笙 (楼主)
    2020-12-28 15:25

    In Scala version 2.11.6 from scala REPL use :require, can best be figured out by using :help from REPL

    For example:

    $ scala
    Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
    Type in expressions to have them evaluated.
    Type :help for more information.
    scala> :require lift-json_2.11-3.0-M5-1.jar
    Added '/lift-json/lift-json_2.11-3.0-M5-1.jar' to classpath.
    

提交回复
热议问题