question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scala 3 repl does not work with -cp argument, needs -repl as workaround

See original GitHub issue

Compiler version

3.0.0 and 3.0.1-RC2

Minimized code and output

The repl cannot be started with a -cp argument.

In 3.0.0 using the .zip from the release on Ubuntu:

$ scala -cp "some.jar" 
warning: command option is not correct.

In 3.0.1-RC2 instead of a warning, the -help output is printed.

Expectation

  • Should start the repl with “some.jar” on claspath.
  • Should work as in Scala 2.

Undocumented workaround:

$ scala -cp "some.jar" -repl

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bishaboshacommented, Aug 20, 2021

When might stable 3.1.0 earliest be out on github releases?

If no issues are found with the 3.1.0-RC1 releasing about September 1 then the 3.1.0 final should be about October 13th

0reactions
bjornregnellcommented, Aug 20, 2021

Great! (I have just added a note in my teaching material that -repl in conjunction with -cp is not needed from Scala 3.1.0. It will be sent to print on sunday…)

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot add a jar to scala repl with the :cp command
No one seems to mention this but the correct solution is using the :require command: scala> :require foo.jar Added 'foo.jar' to classpath.
Read more >
Ammonite REPL
The goal of Ammonite is to liberate your Scala code from heavyweight "projects", using the lightweight Ammonite runtime: if you want to run...
Read more >
Running scala 3 scripts - Question
I am trying to use Scala 3 as scripting language now, encountered few obstacles, so i wonder what ... The 'scala Hello.scala' did...
Read more >
Scala: How to add Jar files and classes to the REPL Classpath
Problem. You want to add individual classes or one or more JAR files ... the REPL session, add the -cp or -classpath argument...
Read more >
How to run Scala 3 applications in the command line with ...
This work-around seems to work for me: cs launch scala3-repl:3+ -M dotty.tools.MainGenericRunner -- YourScala3File.scala. This way, you don't even have to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found