0
votes

I don't know what's going on or even how to figure it out, but I have a Scala Hello World object, like this.

object TestFoo {
  def main(args: Array[String]): Unit = {
    println("Hello World")
  }
}

The Scala IDE for Eclipse (for Scala 2.9, running Eclipse Indigo) shows no errors and has created a compiled class. When I go to Run > Run As > Scala Application, the terminal console shows no output. However, when I go to the command-line and run scala directly (using the class file Eclipse compiled), I get the correct output:

% scala -cp bin/classes TestFoo
Hello World

Any ideas on what I may have done wrong or can do to correct the problem so that output shows up in Eclipse?

Update: I checked the Console output from Eclipse to see if there was anything usual there after one of the commenters suggesting checking the error log. I see a crash report for Java, with this as the exception:

Java information:
 Exception type: Internal Error (/SourceCache/JavaJDK16/JavaJDK16-424/hotspot/src/share/vm/runtime/fieldDescriptor.cpp, line 85)

#  guarantee(_name_index != 0 && _signature_index != 0) failed: bad constant pool index for fieldDescriptor
1
If you are asking if posting some pages long help document without specifying what about it you think would be helpful helps, then no. What specifically about that document do you think I might be missing? I've read through it and may have overlooked something, but I don't know what it might be.zostay
Have you tried Scala > Run Setup Diagnostics? Failing that, you could try opening a new workspace and see if you still get the same problemLuigi Plinge
Is there anything in the Eclipse Error Log?Matthew Farwell
Nothing in setup diagnostics, but a new workspace resolved it. That gives me something to work with in trying to find the problem at least. Thanks.zostay

1 Answers

1
votes

Okay, so after further investigation it appears that everything was working correctly so long as I use a Scala project for doing the work. It might also work with a typical Java project running a mix of Scala and Java.

In this case, I was trying to get a test script running in an Android project and it cannot find the terminal there at all and has the exception reported. That's what I was doing wrong.

If you are having trouble running a console app from within an Android project or some other non-Scala project, that's probably the problem. Use a Scala project for such things.