Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scala "error: io error while decoding" "with utf-8"

Tags:

this thing keeps coming up I checked that all my source files are utf8 encoded, and Im using '-encoding UTF8' flag with both scalac and scala command line tools
any ideas?

thank you

like image 321
deepblue Avatar asked Dec 18 '09 19:12

deepblue


3 Answers

Just to document this, the problem is that the program was being run like this:

scala filename.class

Instead, it should be run like this:

scala package.hierarchy.Object

Where Object is the name of an main-containing object that you wish to run.

like image 64
Daniel C. Sobral Avatar answered Oct 07 '22 04:10

Daniel C. Sobral


I encountered this problem running sbt "test" with Main.scala, for the indicated reason that it wasn't saved in UTF-8. I fixed it by changing Eclipse Main.scala "File / Properties / Text file encoding / Other" to "UTF-8" and saving.

like image 39
user43702 Avatar answered Oct 07 '22 04:10

user43702


I was having this error trying to set a classpath to launch the scala interpreter like scala-2.8 /path/to/jars/*.

The solutions in this thread Setting multiple jars in java classpath solved my problem; apparently the interpreter was attempting to open a jar file as if it was a text file containing scala commands.

Actually, I noticed that just putting the classpath in quotes prevents this message. The message means it is trying to load a .jar file as a scala program to be interpreted. It can't since it's binary.

scala-2.8 "/path/to/jars/*" works fine. The classpath and asterisk is then expanded by Java, not the shell.

like image 20
JAL Avatar answered Oct 07 '22 04:10

JAL