Does anyone know how to run the scala executable in Git Bash shell?

余生颓废 提交于 2019-12-25 12:00:06

问题


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:

  1. Edit the system variables PATH
  2. Find the scala\bin entry
  3. Replace the C:\Program Files with Progra~1 or C:\Program Files (x86) with Progra~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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!