问题
I have installed Scala on my Windows 7 system. When I run "scala -version" from the Windows command prompt, I get: Scala code runner version 2.11.4 -- Copyright 2002-2013, LAMP/EPFL When I run "scala -version" from a Git Bash shell, required by Swagger and other frameworks, I get: Error: Could not find or load main class Files
Does anyone know how to run the scala executable from a Git Bash shell?
回答1:
I'm guessing that you've installed Scala on C:\Program Files (x86)
or C:\Program Files
. As far as I can tell, git bash has problems reading the classpath if it has spaces and/or "()" in it.
If you're on a Win7 64-bit system, the easiest thing for you is:
- Edit the system variables PATH
- Find the scala\bin entry
- Replace the
C:\Program Files
withProgra~1
orC:\Program Files (x86)
withProgra~2
If you're not on a 64-bit system, (which I can't verify due to not having one), you'll have to do some escaping so that PATH
isn't screwed up with the spaces and/or ().
EDIT: Here's a related SO but with Play instead: Play 2.0-RC3 -- Error: Could not find or load main class
来源:https://stackoverflow.com/questions/27238486/does-anyone-know-how-to-run-the-scala-executable-in-git-bash-shell