Can compile scala file but but run it


I know i can use sbt to avoid all this problem but just for knowledge sake. I am not sure why i can compile the code but not able to run it.

My directory structure is as such:

$ ls io_monad/*


cats-core_2.12-0.9.0.jar cats-effect_2.12-0.7.jar

Simple Test.scala file

package io_monad

import cats.effect.IO

object Test extends App {

    val program:IO[Unit] = for {
        _         <- IO { println("First name?") }
        firstName <- IO { }
        _         <- IO { println(s"Last name?") }
        lastName  <- IO { }
        _         <- IO { println(s"First: $firstName, Last: $lastName") }
    } yield ()


Compiling successful

$ scalac -cp "io_monad/lib/cats-core_2.12-0.9.0.jar:io_monad/lib/cats-effect_2.12-0.7.jar" -d io_monad/classes io_monad/Test.scala

But not the running of app

$ scala -cp "io_monad/lib/cats-core_2.12-0.9.0.jar:io_monad/lib/cats-effect_2.12-0.7.jar:io_monad/classes/" io_monad.Test
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
java.lang.ClassNotFoundException: cats.kernel.Semigroup


Problem solved, it was lacking some other libraries


Also posted at