Scala ide can't compile or run a project with one object and one method

2,359 views
Skip to first unread message

Dean Schulze

unread,
Sep 12, 2015, 6:35:22 PM9/12/15
to Scala IDE User
I created a project with sbt with one object and one method:

object Main {

  def main(args:Array[String]) {
    println("Main")
  }
}



I have a minimal build.sbt

name := "akka-in-action.ch02"

version := "1.0"

scalaVersion := "2.11.7"



I ran 
sbt eclipse

and imported the project into scala-ide.  Scala-ide reports these errors:

akka-in-action.ch02's tests not built due to errors in dependent scope(s) main akka-in-action.ch02 Unknown Scala Problem
Error in Scala compiler: null akka-in-action.ch02 Unknown Scala Problem
SBT builder crashed while compiling. The error message is 'null'. Check Error Log for details. akka-in-action.ch02 Unknown Scala Problem


This code compiles and runs under sbt.

Is this a problem with scala-ide or with sbt, or with trying to use them together?

I'm a longtime Eclipse/Java/Maven user and I've been working with Scala for a few weeks now.  I can't believe how bad scala-ide is.  I know it can't handle objects that extend App very well so I've gone to just putting the main() method in an object, but it can't handle that either.

Am I missing something or is scala-ide just this bad?  Is the scala support in IntelliJ much better?

Thanks.

Simon Schäfer

unread,
Sep 13, 2015, 12:28:22 PM9/13/15
to scala-i...@googlegroups.com


On 09/13/2015 12:35 AM, Dean Schulze wrote:
I created a project with sbt with one object and one method:

object Main {

  def main(args:Array[String]) {
    println("Main")
  }
}



I have a minimal build.sbt

name := "akka-in-action.ch02"

version := "1.0"

scalaVersion := "2.11.7"



I ran 
sbt eclipse

and imported the project into scala-ide.  Scala-ide reports these errors:

akka-in-action.ch02's tests not built due to errors in dependent scope(s) main akka-in-action.ch02 Unknown Scala Problem
Error in Scala compiler: null akka-in-action.ch02 Unknown Scala Problem
SBT builder crashed while compiling. The error message is 'null'. Check Error Log for details. akka-in-action.ch02 Unknown Scala Problem


This code compiles and runs under sbt.

Is this a problem with scala-ide or with sbt, or with trying to use them together?
Which Scala IDE version do you use (what is shown in "Scala > Report a bug")? Also, is there a stack trace shown in the error log?


I'm a longtime Eclipse/Java/Maven user and I've been working with Scala for a few weeks now.  I can't believe how bad scala-ide is.  I know it can't handle objects that extend App very well so I've gone to just putting the main() method in an object, but it can't handle that either.
I can't remember the last time when I had a problem running a Scala application in the IDE. Maybe there is something broken in your installation, if you show the error log I should be able to say more.

Am I missing something or is scala-ide just this bad?  Is the scala support in IntelliJ much better?

Thanks.

--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scala-ide-user/8269da32-fbc4-4238-8a1f-d4ba643424ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

wpopie...@virtuslab.com

unread,
Sep 13, 2015, 3:06:46 PM9/13/15
to Scala IDE User
Well, error seems somehow weird. Unfortunately I cannot verify it right now but maybe it is a problem of found and used scala installation? An error comes from sbt so it would suggest some libs inconsistency. But as I said I cannot verify it.

Brian Kent

unread,
Sep 13, 2015, 8:34:51 PM9/13/15
to Scala IDE User
Does your declared package match the actual file structure?

I have issues with the "Run As >> Scala Application" not showing if there is an inconsistency.

Dean Schulze

unread,
Sep 13, 2015, 10:14:30 PM9/13/15
to scala-i...@googlegroups.com
Here's what the .log file shows.  It looks like something with the Scala-ide / sbt integration.

I haven't had any more problems, but the original error messages still show in the Problems view.  They never go away when the code compiles cleanly or when there are compile errors in the code (determined by sbt compile).  The NullPointerException probably prevents updating the Problems view.

=================================================================

2015-09-12 16:58:04,490 ERROR [main] - org.scala-ide.sdt.core - org.scala-ide.sdt.core - org.scala-ide.sdt.core - 0 - Error in Scala compiler
java.lang.NullPointerException
at org.scalaide.core.internal.builder.zinc.SbtInputs$$anon$2$$anon$1$$anonfun$outputGroups$1$$anon$3.sourceDirectory(SbtInputs.scala:92)
at sbt.CompileSetup$$anon$3$$anonfun$equiv$1.apply(CompileSetup.scala:42)
at sbt.CompileSetup$$anon$3$$anonfun$equiv$1.apply(CompileSetup.scala:40)
at scala.collection.IndexedSeqOptimized$class.prefixLengthImpl(IndexedSeqOptimized.scala:38)
at scala.collection.IndexedSeqOptimized$class.forall(IndexedSeqOptimized.scala:43)
at scala.collection.mutable.ArrayOps$ofRef.forall(ArrayOps.scala:186)
at sbt.CompileSetup$$anon$3.equiv(CompileSetup.scala:40)
at sbt.CompileSetup$$anon$3.equiv(CompileSetup.scala:35)
at sbt.CompileSetup$$anon$1.equiv(CompileSetup.scala:26)
at sbt.CompileSetup$$anon$1.equiv(CompileSetup.scala:24)
at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:150)
at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70)
at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:45)
at org.scalaide.core.internal.builder.zinc.EclipseSbtBuildManager.aggressiveCompile(EclipseSbtBuildManager.scala:213)
at org.scalaide.core.internal.builder.zinc.EclipseSbtBuildManager.runCompiler(EclipseSbtBuildManager.scala:142)
at org.scalaide.core.internal.builder.zinc.EclipseSbtBuildManager.update(EclipseSbtBuildManager.scala:127)
at org.scalaide.core.internal.builder.zinc.EclipseSbtBuildManager.build(EclipseSbtBuildManager.scala:87)
at org.scalaide.core.internal.project.scopes.BuildScopeUnit.build(BuildScopeUnit.scala:57)
at org.scalaide.core.internal.project.SbtScopesBuildManager$$anonfun$build$1.apply(SbtScopesBuildManager.scala:47)
at org.scalaide.core.internal.project.SbtScopesBuildManager$$anonfun$build$1.apply(SbtScopesBuildManager.scala:43)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.scalaide.core.internal.project.SbtScopesBuildManager.build(SbtScopesBuildManager.scala:43)
at org.scalaide.core.internal.project.ScalaProject.build(ScalaProject.scala:591)
at org.scalaide.core.internal.builder.ScalaBuilder.build(ScalaBuilder.scala:119)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:299)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:302)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:263)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:401)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:114)
at org.eclipse.debug.core.model.LaunchConfigurationDelegate$1.run(LaunchConfigurationDelegate.java:430)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2295)
at org.eclipse.debug.core.model.LaunchConfigurationDelegate.buildProjects(LaunchConfigurationDelegate.java:437)
at org.eclipse.debug.core.model.LaunchConfigurationDelegate.buildForLaunch(LaunchConfigurationDelegate.java:130)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


--
You received this message because you are subscribed to a topic in the Google Groups "Scala IDE User" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scala-ide-user/gPpwsthSPL0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scala-ide-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scala-ide-user/e6e67a30-d1e1-408b-bc16-12181ee42e2b%40googlegroups.com.

Dean Schulze

unread,
Sep 13, 2015, 10:15:13 PM9/13/15
to scala-i...@googlegroups.com
Yes, the declared package matches the directory structure.

On Sun, Sep 13, 2015 at 6:34 PM, Brian Kent <brian....@gmail.com> wrote:

wpopie...@virtuslab.com

unread,
Sep 14, 2015, 2:52:00 AM9/14/15
to Scala IDE User
Dean,

sorry for asking it again but I didn't notice what Scala IDE version you're using and what sbt version you used to make a project. As I said, such problems may be caused by jars versions inconsistency. I'm going to verify it today.

Cheers.
W.

wpopie...@virtuslab.com

unread,
Sep 14, 2015, 3:46:32 AM9/14/15
to Scala IDE User
Obviously there is a problem with project structure. This NPE you got is result of the 'getLocation' method execution which returns 'null' when path location cannot be determined. Drilling down...


W dniu poniedziałek, 14 września 2015 04:15:13 UTC+2 użytkownik Dean Schulze napisał:

wpopie...@virtuslab.com

unread,
Sep 14, 2015, 4:31:00 AM9/14/15
to Scala IDE User
I tried to reproduce but I failed. Used Scala IDE 4.1.1, sbt 0.13.8 to generate eclipse project.
sbt eclipse results with .classpath:
<classpath>
  <classpathentry kind="src" path="src\main\scala-2.11"/>
  <classpathentry kind="src" path="src\main\scala"/>
  <classpathentry kind="src" path="src\main\java"/>
  <classpathentry kind="src" path="src\main\resources"/>
  <classpathentry kind="src" path="src\test\scala-2.11"/>
  <classpathentry kind="src" path="src\test\scala"/>
  <classpathentry kind="src" path="src\test\java"/>
  <classpathentry kind="src" path="src\test\resources"/>
  <classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="output" path="bin"/>
</classpath>
.project
<projectDescription>
  <name>dean-bug.ch03</name>
  <buildSpec>
    <buildCommand>
      <name>org.scala-ide.sdt.core.scalabuilder</name>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>org.scala-ide.sdt.core.scalanature</nature>
    <nature>org.eclipse.jdt.core.javanature</nature>
  </natures>
  <linkedResources> </linkedResources>
</projectDescription>

the folders structure reflects entries in .classpath file
Main.scala was put into src/main/scala-2.11

Everything compiled and run fine.

Dean Schulze

unread,
Sep 14, 2015, 8:57:41 AM9/14/15
to scala-i...@googlegroups.com
Scala IDE Version: Build id: 4.1.0-vfinal-20150525-1102-Typesafe
sbt version:  0.13.8

Dean Schulze

unread,
Sep 14, 2015, 9:02:52 AM9/14/15
to scala-i...@googlegroups.com
The difference was that you used src/main/scala-2.11 and I used src/main/scala.  When I renamed the scala/ dir to scala-2.11/ and re-ran sbt eclipse everything worked.  No Exceptions and the error messages in scala-ide went away.  I can also run the project in scala-ide which I couldn't before.

The "Getting Started with sbt" document says to use src/main/scala/ on pg. 11.  Since it's necessary to use src/main/scala-2.11/  to get scala-ide to work that document should be updated.

Thanks.




Simon Schäfer

unread,
Sep 14, 2015, 9:56:13 AM9/14/15
to scala-i...@googlegroups.com


On 09/14/2015 03:02 PM, Dean Schulze wrote:
The difference was that you used src/main/scala-2.11 and I used src/main/scala.  When I renamed the scala/ dir to scala-2.11/ and re-ran sbt eclipse everything worked.  No Exceptions and the error messages in scala-ide went away.  I can also run the project in scala-ide which I couldn't before.

The "Getting Started with sbt" document says to use src/main/scala/ on pg. 11.  Since it's necessary to use src/main/scala-2.11/  to get scala-ide to work that document should be updated.
It shouldn't matter how the source folder is named. "scala-2.11" is used as a convention for code that should only be compiled with Scala 2.11 whereas the source folder "scala" is used for any Scala version.

Is it possible that you restore the project to the state where the error occurred? If yes, could you please pack it into an archive (including the sbt build file + all the generated Eclipse files) and send it to us in order to allow us to reproduce the problem?

Since you already posted the Scala IDE version, which is used by you, I could find the location of the error but I still do not understand how it can happen. With the erroneous project hopefully this could be unveiled.
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scala-ide-user/CA%2BLiX6GxyHFA79H4s_KocH3omSzydKH_-P9GfQ5DqBKAK2cTCQ%40mail.gmail.com.

Dean Schulze

unread,
Sep 14, 2015, 10:46:59 PM9/14/15
to scala-i...@googlegroups.com
I had not checked the original project into git when I was having the problem so I tried to recreate the project.

I created a new project and directory structure and added the Main.scala and build.sbt from above.  I ran "sbt eclise" and imported the project into scala-ide.  There were not problems.  I was also able to run the project from scala-ide.

One small issue was when creating the Run Configuration when I browsed for the main class the browse dialog did not show my Main.scala with the main() method.  Entering the fully qualified class name worked.

I've attached the project for whatever that is worth.

If I run into this again I will check it into git at that point and tag it so I can submit it.

Thanks for your help.





scala.ide.test.tgz

wpopie...@virtuslab.com

unread,
Sep 15, 2015, 2:42:38 AM9/15/15
to Scala IDE User


W dniu wtorek, 15 września 2015 04:46:59 UTC+2 użytkownik Dean Schulze napisał:
I had not checked the original project into git when I was having the problem so I tried to recreate the project.

I created a new project and directory structure and added the Main.scala and build.sbt from above.  I ran "sbt eclise" and imported the project into scala-ide.  There were not problems.  I was also able to run the project from scala-ide.

One small issue was when creating the Run Configuration when I browsed for the main class the browse dialog did not show my Main.scala with the main() method.  Entering the fully qualified class name worked.

yeah, Run Configuration uses eclipse built-it java main class search engine. And this is the reason that it cannot find scala object. Hmm want to improve it but there is the staff shortage. If you want to join us don't stagger :).

Michael Soegtrop

unread,
Oct 21, 2015, 12:23:33 PM10/21/15
to Scala IDE User
Dear Scale IDE Team,

I also just started with Scala and Scala IDE and must say it is rather bumy ;-) I run into the same error outlined above. The issue that you just get the not very helpful error message "Scala Compiler Error" is easy to reproduce. Another issue with Scala IDE is that the download page (http://scala-ide.org/download/sdk.html) says Scala IDE does include Scala 2.11.7, while it doesn't seem to include any scala (at least I cannot find scala.exe but it might also be that this is somehow hidden and the only issue is the one described below). Yet another issue is that the Scala 2.11.7 setup does not update the PATH environment variable although it says it would.

Now the sequence to reproduce the "Error in Scala compiler" issue:

- Create New Scala Project
  - Project Name = Test
  - Use project folder as root for source and class files (if default option is used it works!)
  - All other options default
  - Finish

- New Scala Object
  - Name = Test
  - Finish

- Enter Code


object Test {

   def main(args: Array[String]){

   println("Hello world!")

   }

}


- Saving the file results in


"Error in Scala compiler"

java.lang.NullPointerException
 at org.scalaide.core.internal.builder.zinc.SbtInputs$$anon$2$$anonfun$classpath$1.apply(SbtInputs.scala:78)
 at org.scalaide.core.internal.builder.zinc.SbtInputs$$anon$2$$anonfun$classpath$1.apply(SbtInputs.scala:78)
 at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
 at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
 at scala.collection.immutable.List.foreach(List.scala:381)
 at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
 at scala.collection.immutable.List.map(List.scala:285)
 at org.scalaide.core.internal.builder.zinc.SbtInputs$$anon$2.classpath(SbtInputs.scala:78)
 at org.scalaide.core.internal.builder.zinc.EclipseSbtBuildManager.aggressiveCompile(EclipseSbtBuildManager.scala:218)
 at org.scalaide.core.internal.builder.zinc.EclipseSbtBuildManager.runCompiler(EclipseSbtBuildManager.scala:148)
 at org.scalaide.core.internal.builder.zinc.EclipseSbtBuildManager.update(EclipseSbtBuildManager.scala:130)
 at org.scalaide.core.internal.builder.zinc.EclipseSbtBuildManager.build(EclipseSbtBuildManager.scala:90)
 at org.scalaide.core.internal.project.scopes.BuildScopeUnit.build(BuildScopeUnit.scala:73)

 at org.scalaide.core.internal.project.SbtScopesBuildManager$$anonfun$build$1.apply(SbtScopesBuildManager.scala:47)
 at org.scalaide.core.internal.project.SbtScopesBuildManager$$anonfun$build$1.apply(SbtScopesBuildManager.scala:43)
 at scala.collection.immutable.List.foreach(List.scala:381)
 at org.scalaide.core.internal.project.SbtScopesBuildManager.build(SbtScopesBuildManager.scala:43)
 at org.scalaide.core.internal.project.ScalaProject.build(ScalaProject.scala:591)
 at org.scalaide.core.internal.builder.ScalaBuilder.build(ScalaBuilder.scala:117)

 at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
 at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
 at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
 at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
 at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:299)
 at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
 at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:302)
 at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:358)
 at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:381)
 at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
 at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
 at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Scala Version is 2.11.7
Scala IDE Build id: 4.2.0-vfinal-2015-09-25T11:10:29Z-Typesafe
Platform: Windows7 64bit

Best regards,

Michael

wpopie...@virtuslab.com

unread,
Oct 21, 2015, 12:36:50 PM10/21/15
to Scala IDE User
Hello,

sorry I don't get you. Are you using project folder as root folder for sources? Like my_project/ instead of /my_project/src ?

W.

Simon Schäfer

unread,
Oct 21, 2015, 12:58:12 PM10/21/15
to scala-i...@googlegroups.com


On 10/21/2015 05:49 PM, Michael Soegtrop wrote:
Dear Scale IDE Team,

I also just started with Scala and Scala IDE and must say it is rather bumy ;-) I run into the same error outlined above. The issue that you just get the not very helpful error message "Scala Compiler Error" is easy to reproduce. Another issue with Scala IDE is that the download page (http://scala-ide.org/download/sdk.html) says Scala IDE does include Scala 2.11.7, while it doesn't seem to include any scala (at least I cannot find scala.exe but it might also be that this is somehow hidden and the only issue is the one described below). Yet another issue is that the Scala 2.11.7 setup does not update the PATH environment variable although it says it would.
Actually, the Scala installation is part of the IDE but it doesn't alter your system. If you want to open a console with Scala outside of the IDE, you still need to download Scala separately and install it as described on scala-lang.org. Beside from that the Scala REPL is part of the IDE and can be opened through the Eclipse console.


Now the sequence to reproduce the "Error in Scala compiler" issue:
I can't reproduce this problem. Would you please pack the project that produces the error in an archive and send it to us? This way we hopefully can easily reproduce the problem.
--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.

iulian dragos

unread,
Oct 21, 2015, 1:05:31 PM10/21/15
to scala-i...@googlegroups.com

Hey Michael,

Welcome to the Scala IDE mailing list!

On Wed, Oct 21, 2015 at 5:49 PM, Michael Soegtrop <michael....@intel.com> wrote:

Dear Scale IDE Team,

I also just started with Scala and Scala IDE and must say it is rather bumy ;-) I run into the same error outlined above. The issue that you just get the not very helpful error message "Scala Compiler Error" is easy to reproduce. Another issue with Scala IDE is that the download page (http://scala-ide.org/download/sdk.html) says Scala IDE does include Scala 2.11.7, while it doesn't seem to include any scala (at least I cannot find scala.exe but it might also be that this is somehow hidden and the only issue is the one described below). Yet another issue is that the Scala 2.11.7 setup does not update the PATH environment variable although it says it would.

That’s wrong. Can you point us to where it says that, so we can fix it? Scala IDE comes with Scala in the same way that Eclipse come with Java: you can start coding and run Scala applications right away. But neither one nor the other does install a scalac or javac on your system, nor updates your PATH. It’s all jars, anyway :)


Now the sequence to reproduce the "Error in Scala compiler" issue:

- Create New Scala Project
  - Project Name = Test
  - Use project folder as root for source and class files (if default option is used it works!)

You might be the first person to try that! :) Thanks for the bug report, it’s probably a corner case we haven’t stepped on yet. In the mean-time, please use a separate source folder, it’s good practice and most Scala projects follow Java conventions (src/ or src/main/scala).

iulian

Michael Soegtrop

unread,
Oct 22, 2015, 8:19:47 AM10/22/15
to Scala IDE User
Dear Iulian, 

That’s wrong. Can you point us to where it says that, so we can fix it? Scala IDE comes with Scala in the same way that Eclipse come with Java: you can start coding and run Scala applications right away. But neither one nor the other does install a scalac or javac on your system, nor updates your PATH. It’s all jars, anyway :)


Content

  • Eclipse 4.4.2 (Luna)
  • Scala IDE 4.2.0
  • Scala 2.11.7 and Scala 2.10.5
  • Sbt 0.13.8 

- Create New Scala Project
  - Project Name = Test
  - Use project folder as root for source and class files (if default option is used it works!)

You might be the first person to try that! :) Thanks for the bug report, it’s probably a corner case we haven’t stepped on yet. In the mean-time, please use a separate source folder, it’s good practice and most Scala projects follow Java conventions (src/ or src/main/scala).


Possibly only beginners fall into this trap. I thought for a hello world app I don't need a folder structure.

One more thing which is not easy to understand for beginners are the run configurations. I work a lot with eclipse in all variants (java tp embedded cross C) and understand the concept, but for the scala beginner it is not easy to guess the main class. Some hello world apps run fine with console scalac, but not with Scala IDE. For example:

import swing._

  object HelloWorldGUI extends SimpleSwingApplication{

     def top = new MainFrame {

     contents = new Label("Hello world!")

   }

}


As a beginner I wonder why console scala can figure out what to run here, but Scala IDE can't? Maybe a "Very first steps with Scala IDE" document would help.


Best regards,


Michael

Michael Soegtrop

unread,
Oct 22, 2015, 8:22:06 AM10/22/15
to Scala IDE User
> sorry I don't get you. Are you using project folder as root folder for sources? Like my_project/ instead of /my_project/src ?

Yes, since there is such an option in the project wizard, I tried it for the hello world project. As it looks, this was not a good idea. Probably it would be best to remove this option.

Best regards,

Michael

iulian dragos

unread,
Oct 22, 2015, 8:36:10 AM10/22/15
to scala-i...@googlegroups.com
On Thu, Oct 22, 2015 at 2:19 PM, Michael Soegtrop <michael....@intel.com> wrote:
Dear Iulian, 

That’s wrong. Can you point us to where it says that, so we can fix it? Scala IDE comes with Scala in the same way that Eclipse come with Java: you can start coding and run Scala applications right away. But neither one nor the other does install a scalac or javac on your system, nor updates your PATH. It’s all jars, anyway :)


Content

  • Eclipse 4.4.2 (Luna)
  • Scala IDE 4.2.0
  • Scala 2.11.7 and Scala 2.10.5
  • Sbt 0.13.8 
Oh, ok. So nothing about the PATH variable being set. Ok, we can maybe word it better (neither does Sbt appear on you PATH after downloading Eclipse, there's no installation step at all, it's just unzipping an archive).

 

- Create New Scala Project
  - Project Name = Test
  - Use project folder as root for source and class files (if default option is used it works!)

You might be the first person to try that! :) Thanks for the bug report, it’s probably a corner case we haven’t stepped on yet. In the mean-time, please use a separate source folder, it’s good practice and most Scala projects follow Java conventions (src/ or src/main/scala).


Possibly only beginners fall into this trap. I thought for a hello world app I don't need a folder structure.

One more thing which is not easy to understand for beginners are the run configurations. I work a lot with eclipse in all variants (java tp embedded cross C) and understand the concept, but for the scala beginner it is not easy to guess the main class. Some hello world apps run fine with console scalac, but not with Scala IDE. For example:

import swing._

  object HelloWorldGUI extends SimpleSwingApplication{

     def top = new MainFrame {

     contents = new Label("Hello world!")

   }

}


As a beginner I wonder why console scala can figure out what to run here, but Scala IDE can't? Maybe a "Very first steps with Scala IDE" document would help.


Best regards,


Michael

--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais

Michael Soegtrop

unread,
Oct 22, 2015, 8:53:44 AM10/22/15
to Scala IDE User
 

Content

  • Eclipse 4.4.2 (Luna)
  • Scala IDE 4.2.0
  • Scala 2.11.7 and Scala 2.10.5
  • Sbt 0.13.8 
Oh, ok. So nothing about the PATH variable being set. Ok, we can maybe word it better (neither does Sbt appear on you PATH after downloading Eclipse, there's no installation step at all, it's just unzipping an archive).
 
This was in the setup of scala itself. There is an installation module called "Update System PATH", but it doesn't update the system path.
 
 
I just mentioned it here to show how my first day with scala went:
  • Install Scala IDE, make a hello world project from the tutorials => "Scala Compiler Error"
  • Hmm might be that there is no compiler => Install command line scala => "Scala Compiler Error"
  • Does the scala work from command line => no, not in path
  • Add scala to path => works from command line
  • Try Scala IDE => "Scala Compiler Error"
  • 2 hours of googling => might be some issue with pathes => Create new project wih src folder => Works :-)
  • Try swing based hello world app => Compiles, although IDE shows errors => Doesn't run cause of missing main class
That's what I meant by "a bit bumpy".

Best regards,

Michael
Auto Generated Inline Image 1

Rafał Pokrywka

unread,
Oct 22, 2015, 1:14:39 PM10/22/15
to Scala IDE User
Hi Michael,

Thanks for Your feedback, it's very valuable - I think it's a good idea to prepare an info or guide how to start and not fall into kind of initial blockers so that new users could just seamlessly start working on the code  
We will look into the installer PATH option too.

Thanks You,
Rafał

Simon Schäfer

unread,
Oct 23, 2015, 10:38:59 AM10/23/15
to scala-i...@googlegroups.com


On 10/22/2015 02:53 PM, Michael Soegtrop wrote:
 

Content

  • Eclipse 4.4.2 (Luna)
  • Scala IDE 4.2.0
  • Scala 2.11.7 and Scala 2.10.5
  • Sbt 0.13.8 
Oh, ok. So nothing about the PATH variable being set. Ok, we can maybe word it better (neither does Sbt appear on you PATH after downloading Eclipse, there's no installation step at all, it's just unzipping an archive).
 
This was in the setup of scala itself. There is an installation module called "Update System PATH", but it doesn't update the system path.
The Scala installer is a separate tool. We do not have control over it. I don't even know who maintains it.

 
I just mentioned it here to show how my first day with scala went:
Yeah, the first days of learning something new can often be annoying. Not an excuse for us though to not make it better.

  • Install Scala IDE, make a hello world project from the tutorials => "Scala Compiler Error"
You should have read the error message better. It should have told you what is wrong.

  • Hmm might be that there is no compiler => Install command line scala => "Scala Compiler Error"
  • Does the scala work from command line => no, not in path
  • Add scala to path => works from command line
  • Try Scala IDE => "Scala Compiler Error"
  • 2 hours of googling => might be some issue with pathes => Create new project wih src folder =>
The exact error message would be helpful to help in hindsight. Beside from that, the possibility to create a project without a source folder is an artifact of Eclipse, we can't forbid our users to create one.

  • Works :-)
  • Try swing based hello world app => Compiles, although IDE shows errors => Doesn't run cause of missing main class
Scala Swing is part of a standalone library. As far as I know, the REPL automatically adds them to the classpath. Scala IDE is not doing that since 2.11. You have to download it manually and then add it to the classpath. Or use sbt and add it as a dependency.
That's what I meant by "a bit bumpy".

Best regards,

Michael
--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.

Michael Soegtrop

unread,
Oct 23, 2015, 12:31:03 PM10/23/15
to Scala IDE User
  • Install Scala IDE, make a hello world project from the tutorials => "Scala Compiler Error"
You should have read the error message better. It should have told you what is wrong.

The exact error message is above. The first few lines are:
"Error in Scala compiler"
 
java.lang.NullPointerException
 at org.scalaide.core.internal.builder.zinc.SbtInputs$$anon$2$$anonfun$classpath$1.apply(SbtInputs.scala:78)
 at org.scalaide.core.internal.builder.zinc.SbtInputs$$anon$2$$anonfun$classpath$1.apply(SbtInputs.scala:78)
 at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245) 
 
I honestly don't think that this get's any more understandable (at least for a beginner) by more careful reading ;-)
 
Don't get me wrong: I don't want to complain. Scala is such a nice language and as a long time Eclipse user chosing Scale IDE was the most natural choice for me. You put so much work into this and I just want to help you to give your work more impact. Most people won't bear with you for more than 2 hours. If you loose them, you might loose them forever. I don't think it would be a lot of work to come up with some documentation which helps people to have a good first day with Scala.

Best regards,

Michael


Simon Schäfer

unread,
Oct 23, 2015, 1:39:40 PM10/23/15
to scala-i...@googlegroups.com
You can help us by showing us the full stack traces. Based on the one above, I at least could improve the error message that would be shown in your case. The problem is still not fixed since I do not know how to reproduce the problem. If you can remember the steps you did that led you to the problem it would be very helpful to us if you would report them back.

The origin of the problem is that you either configured something wrong explicitly or that the IDE got in some invalid state due to a bug. The latter case should not happen and can only be fixed if we can reproduce the problem. The former case is clearly a documentation problem but I can't see how to improve the docs to a point where you would avoid running into these problems. There is just too much implicit knowledge one has to know to avoid these kind of problems.


Best regards,

Michael


--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.

iulian dragos

unread,
Oct 24, 2015, 3:28:47 AM10/24/15
to scala-i...@googlegroups.com
Michael,

Your feedback is extremely valuable for us. I can only guess how many others hit issues and din't take the time to report back!

I had worked on a "Cheat Sheet" and intro page for Scala IDE, which would pop up as the first thing when you install the plugin (the full page with links to tutorials) and a couple of small tutorials:


If anyone is motivated to push them to the finish line, this could be help those first 5 minutes.

--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Soegtrop, Michael

unread,
Oct 26, 2015, 5:23:35 AM10/26/15
to scala-i...@googlegroups.com

Dear Simon,

 

You can help us by showing us the full stack traces. Based on the one above, I at least could improve the error message that would be shown in your case. The problem is still not fixed since I do not know how to reproduce the problem. If you can remember the steps you did that led you to the problem it would be very helpful to us if you would report them back.

 

The full stack trace as well as detailed instructions for reproducing the problem are in my first post on this topic (from October 21). In short: create a hello world project and tick the option to not create separate source folders.

 

Best regards,

 

Michael

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Prof. Dr. Hermann Eul
Chairperson of the Supervisory Board: Tiffany Doon Silva
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

Soegtrop, Michael

unread,
Oct 26, 2015, 5:44:22 AM10/26/15
to scala-i...@googlegroups.com

Dear Iulian,

 

I had worked on a "Cheat Sheet" and intro page for Scala IDE, which would pop up as the first thing when you install the plugin (the full page with links to tutorials) and a couple of small tutorials:

 

 

It is way hard to follow from the git post;-) I think what would be most useful is a list of caveats for those who are following other Scala tutorials with Scale IDE. The pitfalls I got into as yet:

 

·         The issue with the separate source paths discussed above. If this option cannot be removed, document it in a place that cannot be overlooked and try to improve the error message.

·         It is way non obvious why command line scala doesn’t need to know a main object, but Scala IDE needs to know to run something. It is even less obvious (for beginners) what this main class might be in some cases. For some swing based hello world apps (see below) I still didn’t figure out how to run them with Scala IDE. The whole run configuration topic definitely needs some documentation for beginners. I would even think the run configurations are a bit abused in Scala IDE. Simple apps which don’t require command line arguments or other special settings should run without providing a run configuration in the same way they run with command line Scala. At least this is the behavior of Eclipse I am used to from other languages. The only environment I have seen up to now which always requires a run configuration is embedded cross C, but there the reason why this is needed is obvious.

·         Swing based trivial apps compile (as far as I can tell), but the IDE shows a lot of unknown symbol errors.

 

Below is an example swing based hello world app from some Scala tutorial. This compiles and runs fine with command line Scala but shows an error in pretty much every line in Scala IDE. As far as I can tell it compiles fine with Scala IDE but I couldn’t figure out the main class for the run configuration.

 

Best regards,

 

Michael

 

import swing._

 

object HelloWorld_GUI  extends SimpleSwingApplication {

  def top = new MainFrame {

    contents = new Label("Hello world!")

  }

}

Intel Deutschland GmbH

iulian dragos

unread,
Oct 26, 2015, 6:11:18 AM10/26/15
to scala-i...@googlegroups.com
\

On Mon, Oct 26, 2015 at 10:43 AM, Soegtrop, Michael <michael....@intel.com> wrote:

Dear Iulian,

 

I had worked on a "Cheat Sheet" and intro page for Scala IDE, which would pop up as the first thing when you install the plugin (the full page with links to tutorials) and a couple of small tutorials:

 

 

It is way hard to follow from the git post;-) I think what would be most useful is a list of caveats for those who are following other Scala tutorials with Scale IDE. The pitfalls I got into as yet:


I'm not sure if this is ironic or not... that commit is adding a "tutorial" like feature in Eclipse, some sort of interactive help where the user is guided through the first steps using a new feature. This is the Eclipse help for this meta-feature, but it's not very clear.
 

·         The issue with the separate source paths discussed above. If this option cannot be removed, document it in a place that cannot be overlooked and try to improve the error message.

·         It is way non obvious why command line scala doesn’t need to know a main object, but Scala IDE needs to know to run something. It is even less obvious (for beginners) what this main class might be in some cases. For some swing based hello world apps (see below) I still didn’t figure out how to run them with Scala IDE. The whole run configuration topic definitely needs some documentation for beginners. I would even think the run configurations are a bit abused in Scala IDE. Simple apps which don’t require command line arguments or other special settings should run without providing a run configuration in the same way they run with command line Scala. At least this is the behavior of Eclipse I am used to from other languages. The only environment I have seen up to now which always requires a run configuration is embedded cross C, but there the reason why this is needed is obvious.

This could be a bug, normally "right-click" and Run As Scala Application works just fine. I use it every day. So, ideally, we should be able to reproduce your problem and fix it. Of course, if the project has errors, this won't probably work.

·         Swing based trivial apps compile (as far as I can tell), but the IDE shows a lot of unknown symbol errors.

Swing is an odd place to start with Scala, what kind of tutorial are you following? Swing used to be part of Scala in the early days, but since 2 years ago it was removed from the Standard library, so Eclipse won't include it in the default classpath. It seems the command line version still does, so maybe we can revisit this decision. However, what tutorial are you following?

iulian
 

 

Below is an example swing based hello world app from some Scala tutorial. This compiles and runs fine with command line Scala but shows an error in pretty much every line in Scala IDE. As far as I can tell it compiles fine with Scala IDE but I couldn’t figure out the main class for the run configuration.

 

Best regards,

 

Michael

 

import swing._

 

object HelloWorld_GUI  extends SimpleSwingApplication {

  def top = new MainFrame {

    contents = new Label("Hello world!")

  }

}

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Prof. Dr. Hermann Eul
Chairperson of the Supervisory Board: Tiffany Doon Silva
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Soegtrop, Michael

unread,
Oct 26, 2015, 8:33:27 AM10/26/15
to scala-i...@googlegroups.com

Dear Iulian,

 

It is way hard to follow from the git post;-) I think what would be most useful is a list of caveats for those who are following other Scala tutorials with Scale IDE. The pitfalls I got into as yet:

I'm not sure if this is ironic or not... that commit is adding a "tutorial" like feature in Eclipse, some sort of interactive help where the user is guided through the first steps using a new feature. This is the Eclipse help for this meta-feature, but it's not very clear.

 

Sorry I was unclear. For sure the eclipse cheat sheet is a good idea! But since it is not yet in, I read your material as it appears on github.

 

·         It is way non obvious why command line scala doesn’t need to know a main object, but Scala IDE needs to know to run something. It is even less obvious (for beginners) what this main class might be in some cases. For some swing based hello world apps (see below) I still didn’t figure out how to run them with Scala IDE. The whole run configuration topic definitely needs some documentation for beginners. I would even think the run configurations are a bit abused in Scala IDE. Simple apps which don’t require command line arguments or other special settings should run without providing a run configuration in the same way they run with command line Scala. At least this is the behavior of Eclipse I am used to from other languages. The only environment I have seen up to now which always requires a run configuration is embedded cross C, but there the reason why this is needed is obvious.

This could be a bug, normally "right-click" and Run As Scala Application works just fine. I use it every day. So, ideally, we should be able to reproduce your problem and fix it. Of course, if the project has errors, this won't probably work.

 

I guess what confused me is that the project itself only has a “Run as Java Application” entry. When you select this, you get an error “Selection does not contain a main type”. So after some messing around I created a run configuration where I specify the main object. The “Run as Scala Application” menu entry only exists for individual Scala files, not the project. This is confusing because the application should be represented by the project, and not by an individual file. I am not sure I understand the semantics of “Run as Scala Application” for a single file. Would that have different effects if I select different Scala files from the same project? I guess people would be less confused, if the project would have a “Run as Scala App” menu entry.

·         Swing based trivial apps compile (as far as I can tell), but the IDE shows a lot of unknown symbol errors.

Swing is an odd place to start with Scala, what kind of tutorial are you following? Swing used to be part of Scala in the early days, but since 2 years ago it was removed from the Standard library, so Eclipse won't include it in the default classpath. It seems the command line version still does, so maybe we can revisit this decision. However, what tutorial are you following?

 

Good to know. I was following a German Scala Tutorial, which has this on the first hello world page, directly after install: http://www.scalatutorial.de/topic148.html. Possibly the tutorial it was a bad choice.

 

Best regards,

 

Michael

Reply all
Reply to author
Forward
0 new messages