Thursday, November 05, 2009

Problem running Scala

I was just trying to run scala on my machine and failed to do so with an error message “…..\java.exe unexpected at this time.” Look at the screenshot shown below.

image

Well, the problem was that environment variables for JAVA was set up using JAVA_HOME variable. The JAVA_HOME environment variable was pointing to the JDK directory and the Path was modified to include the “%JAVA_HOME%\bin” directory.

I removed the JAVA_HOME and then modified the path to specify the complete path to the JDK bin folder and it works now. :)

I might be talking more about Scala in the future, the concurrency scala supports appears to be interesting.

9 comments:

Rohit said...

interesting....both the error and ur future work

Anonymous said...

Had the same problem.
Fixed it!!:)

Thanks

gl0wa said...

I've got the same problem running Scala. Was your first JRE 64-bit? Some time ago I had similar problem with Groovy, and changing JRE to 32-bit has solved it.

Anonymous said...

Yip, had the same problem, thanks.

Unknown said...

Had the same problem but solved in a slightly different way.

I had my jdk installed in the default location (c:/program files(x86)/java/etc.. ). Scala does not seem to like the parenthesis or the spaces in that path. Moving my jdk to a folder without parentheses and spaces and changing JAVA_HOME accordingly also solved the problem.

Anonymous said...

Thanks for the post. Everything ran perfect after removing JAVA_HOME, I can start digging into scala on my Vista x64. Dick Wall (of Java Posse fame) should be smiling somewhere?

Anonymous said...

Just spent 1 hour trying to sort this out, your solution works :-)

Thanks!

Krishna Bhargava Vangapandu said...

@mendelt

yeah i recently figured out that as well...I think it has to do with spaces .. not sure though ...

Anonymous said...

I had the same problem as well, My solution was to leave in the JAVA_HOME but remove the parenthesis and spaces. I used this:

set JAVA_HOME=C:\ProgramFilesx86\Java\JDK1.6.0

notice no parenthesis nor spaces as in:

set JAVA_HOME=C:\Program Files (x86)\Java\JDK1.6.0

Other environment variables were:

set SCALA_HOME=C:\Tools\scala-2.8.2.final

set JAVA_OPTS=-Xmx256M -Xms32M

--- Escale510