Home > Blockchain >  Imported Scala Project has no run option
Imported Scala Project has no run option

Time:12-31

I'm taking an online course and was instructed to import a set of exercises into IDEA as a project. I'm unable to run the classes after building and rebuilding the project. There's a separate getting started course which show's you how to do all of this and it works fine, so I'm not sure what's wrong.

No option to run the class

The getting started project works fine

I've compared the build.project files and I see errors: Errors in the main project for the course

I get a message about a problem that I haven't been able to resolve when I run

sbt sbtVersion

in my project directory:

PS M:\School\Scala Applied Part 1> cd .\exercises-applied\
PS M:\School\Scala Applied Part 1\exercises-applied> sbt sbtVersion
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by sbt.TrapExit$ (file:/C:/Users/*/.sbt/boot/scala-2.12.4/org.scala-sbt/sbt/1.1.0/run
_2.12-1.1.0.jar)
WARNING: Please consider reporting this to the maintainers of sbt.TrapExit$
WARNING: System::setSecurityManager will be removed in a future release
[info] Loading project definition from M:\School\Scala Applied Part 1\exercises-applied\project
error: error while loading String, class file '/modules/java.base/java/lang/String.class' is broken
(class java.lang.NullPointerException/Cannot invoke "scala.tools.nsc.Global$Run.typerPhase()" because the return value of "scala.tools.nsc.Gl
obal.currentRun()" is null)

I can't seem to find

/modules/java.base/java/lang/String.class

In the file structure and I don't know how to update it.

CodePudding user response:

build.sbt needs to bee in the root directory. I've changed the root directory of the project and it builds fine. Thanks Mateusz!

  • Related