Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add multiple classpath entries to scala REPL classpath

:cp seems to only accept a single entry

scala> :cp /usr/lib/hadoop/*:/usr/lib/hadoop/lib/*:/usr/lib/hbase/*:/usr/lib/hbase/lib/*:
/home/sboesch/spark-master/lib_managed/jars/*:/home/sboesch/spark-master/lib_managed/bundles/*:

The path '/usr/lib/hadoop/*:/usr/lib/hadoop/lib/*:/usr/lib/hbase/*:/usr/lib/hbase/lib/*:/home/sboesch/spark-master/lib_managed/jars/*:/home/sboesch/spark-master/lib_managed/bundles/*:' 
doesn't seem to exist.

Any thoughts on how to do this when already in the REPL. Yes I know how to set it up from outside the REPL :

CLASSPATH=/usr/lib/hadoop/*:/usr/lib/hadoop/lib/*:/usr/lib/hbase/*:/usr/lib/hbase/lib/*
:/home/sboesch/spark-master/lib_managed/jars/*:
/home/sboesch/spark-master/lib_managed/bundles/*:  scala 

EDIT It seems the intent were not clear. I am working on code in the REPL. Then have a new snippet of code that requires a few classpath entries. It is a ONE OFF affair: so I do not want to add to build.sbt or to the scala/lib dir , etc. I did not receive any answer really satisifying this use case, but awarded the best efforts anyways.

like image 611
WestCoastProjects Avatar asked Sep 19 '25 01:09

WestCoastProjects


1 Answers

scala -cp "path1:path2" now seems to work.

scala -version Picked up _JAVA_OPTIONS: -Xms512m -Xmx4096m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=128m Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0 Scala code runner version 2.11.8 -- Copyright 2002-2016, LAMP/EPFL

like image 141
Chris Prince Avatar answered Sep 20 '25 18:09

Chris Prince