This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Problems running class files with 'scala' on OS X

2 replies
Kenneth McDonald
Joined: 2009-01-11,
User offline. Last seen 42 years 45 weeks ago.

A quick terminal session will make this clear (the following class
files were produced by 'scalac'):

Macintosh-5:hello Ken$ ls
HelloWorld$.class HelloWorld.class
Macintosh-5:hello Ken$ scala HelloWorld
no such file: HelloWorld

that should work, but just in case, I tried it using the .class
extension, which also didn't work:

Macintosh-5:hello Ken$ scala HelloWorld.class
error: IO error while decoding /Users/Ken/Projects/hello/
HelloWorld.class with UTF-8
Please try specifying another one using the -encoding option
one error found

Any thoughts on what's going wrong here? All feedback most appreciated.

Thanks,
Ken

Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: Problems running class files with 'scala' on OS X
Can you run scala -version ?
Also, echo $CLASSPATH

I'm assuming you're using bash, as other Mac users seem to.  For more system-specific help, send me a Mac.

2009/1/15 Kenneth McDonald <kenneth [dot] m [dot] mcdonald [at] sbcglobal [dot] net>
A quick terminal session will make this clear (the following class files were produced by 'scalac'):

Macintosh-5:hello Ken$ ls
HelloWorld$.class       HelloWorld.class
Macintosh-5:hello Ken$ scala HelloWorld
no such file: HelloWorld

that should work, but just in case, I tried it using the .class extension, which also didn't work:

Macintosh-5:hello Ken$ scala HelloWorld.class
error: IO error while decoding /Users/Ken/Projects/hello/HelloWorld.class with UTF-8
Please try specifying another one using the -encoding option
one error found

Any thoughts on what's going wrong here? All feedback most appreciated.

Thanks,
Ken

Tony Sloane
Joined: 2009-01-07,
User offline. Last seen 2 years 32 weeks ago.
Re: Problems running class files with 'scala' on OS X

On 15/01/2009, at 1:12 PM, Kenneth McDonald wrote:

> A quick terminal session will make this clear (the following class
> files were produced by 'scalac'):
>
> Macintosh-5:hello Ken$ ls
> HelloWorld$.class HelloWorld.class
> Macintosh-5:hello Ken$ scala HelloWorld
> no such file: HelloWorld
>
> that should work, but just in case, I tried it using the .class
> extension, which also didn't work:
>
> Macintosh-5:hello Ken$ scala HelloWorld.class
> error: IO error while decoding /Users/Ken/Projects/hello/
> HelloWorld.class with UTF-8
> Please try specifying another one using the -encoding option
> one error found
>
> Any thoughts on what's going wrong here? All feedback most
> appreciated.

Is your CLASSPATH environment variable set? I tried exactly your case
on Mac OS X 10.5.6 with Scala 2.7.3-final and it works fine with
CLASSPATH unset or containing "." as one of the components. If it's
set and doesn't contain "." (or the current directory as a full path),
I understandably get the same behaviour as you.

cheers,
Tony

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland