scala-cli
scala-cli copied to clipboard
If a scala file has a colon anywhere in the path (including parent directories) the scala-cli can't run and does not give helpful warnings
Version(s) Probably all but tested on 0.1.15
Describe the bug
scala-cli cannot run scala code that is in a path that contains a : anywhere in the path. Compiling is possible but running is not. There also is not a helpful warning to help the user, the error is just:
Exception in thread "main" java.lang.ClassNotFoundException: main
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at scala.cli.runner.Runner$.main(Runner.scala:13)
at scala.cli.runner.Runner.main(Runner.scala)
in my case the code was:
@main def main = println("test")
, but the bug is reproducible with any code
To Reproduce
- Create a directory with
:in the name, for examplescala:cli - Create a scala file in the newly created directory and put in some code, any code, that you know would run perfectly otherwise.
- Type
scala-cli run .orscala-cli run FileName.scala.
Note: This bug is irrelevant on Windows, since you can't create directories with : in the name on Windows. However it is tested on both Mac and Ubuntu and the bug exists on both.
Expected behaviour The code should run as normal or at least give a meaningful warning.