scala 在 ubuntu 上安装 sbt
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13711395/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Install sbt on ubuntu
提问by NoIdeaHowToFixThis
I have installed sbt on Ubuntu.
我已经在 Ubuntu 上安装了 sbt。
:~/bin/sbt/bin$ ls
classes sbt sbt-launch.jar target
jansi.jar sbt.bat sbt-launch-lib.bash win-sbt
However, whenever I try to launch sbt (from the same directory where sbt is located) it does not work:
但是,每当我尝试启动 sbt(从 sbt 所在的同一目录)时,它都不起作用:
No command 'sbt' found, did you mean:
Command 'skt' from package 'latex-sanskrit' (universe)
Command 'sb2' from package 'scratchbox2' (universe)
Command 'sbd' from package 'cluster-glue' (main)
Command 'mbt' from package 'mbt' (universe)
Command 'sbmt' from package 'atfs' (universe)
Command 'lbt' from package 'lbt' (universe)
Command 'st' from package 'suckless-tools' (universe)
Command 'sb' from package 'lrzsz' (universe)
I am new to linux and I have no idea how to tackle this issue.
我是 linux 新手,我不知道如何解决这个问题。
采纳答案by Liang Zhou
It seems like you installed a zip version of sbt, which is fine. But I suggest you install the native debian package if you are on Ubuntu. That is how I managed to install it on my Ubuntu 12.04. Check it out here: http://www.scala-sbt.org/release/docs/Installing-sbt-on-Linux.htmlOr simply directly download it from here.
您似乎安装了 sbt 的 zip 版本,这很好。但是如果你使用的是 Ubuntu,我建议你安装本地 debian 包。这就是我设法在我的 Ubuntu 12.04 上安装它的方式。在这里查看:http: //www.scala-sbt.org/release/docs/Installing-sbt-on-Linux.html或者直接从这里下载。
回答by paradigmatic
The simplest way of installing SBT on ubuntu is the debpackage provided by Typesafe.
在 ubuntu 上安装 SBT 最简单的方法是debTypesafe 提供的包。
Run the following shell commands:
运行以下 shell 命令:
wget http://apt.typesafe.com/repo-deb-build-0002.debsudo dpkg -i repo-deb-build-0002.debsudo apt-get updatesudo apt-get install sbt
wget http://apt.typesafe.com/repo-deb-build-0002.debsudo dpkg -i repo-deb-build-0002.debsudo apt-get updatesudo apt-get install sbt
And you're done !
大功告成!
回答by Brian
No command
sbtfound
未
sbt找到命令
It's saying that sbtis not on your path. Try to run ./sbtfrom ~/bin/sbt/binor wherever the sbtexecutable is to verify that it runs correctly. Also check that you have execute permissions on the sbtexecutable. If this works , then add ~/bin/sbt/binto your path and sbtshould run from anywhere.
据说那sbt不在你的路上。尝试./sbt从可执行文件所在的位置~/bin/sbt/bin或任何位置运行sbt以验证它是否正确运行。还要检查您是否对sbt可执行文件具有执行权限。如果这有效,然后添加~/bin/sbt/bin到您的路径并且sbt应该从任何地方运行。
See this questionabout adding a directory to your path.
请参阅有关向路径添加目录的问题。
To verify the path is set correctlyuse the whichcommand on LINUX. The output will look something like this:
要验证路径设置是否正确,请which在 LINUX 上使用该命令。输出将如下所示:
$ which sbt
/usr/bin/sbt
Lastly, to verify sbtis working try running sbt -helpor likewise. The output with -help will look something like this:
最后,要验证sbt是否有效,请尝试运行sbt -help或类似操作。带有 -help 的输出将如下所示:
$ sbt -help
Usage: sbt [options]
-h | -help print this message
...
回答by Hyman
As an alternative approach, you can save the SBT Extrasscript to a file called sbt.sh and set the permission to executable. Then add this file to your path, or just put it under your ~/bin directory.
作为替代方法,您可以将SBT Extras脚本保存到名为 sbt.sh 的文件中,并将权限设置为可执行文件。然后将此文件添加到您的路径中,或者将其放在您的 ~/bin 目录下。
The bonus here, is that it will download and use the correct version of SBT depending on your project properties. This is a nice convenience if you tend to compile open source projects that you pull from GitHub and other.
这里的好处是,它将根据您的项目属性下载和使用正确版本的 SBT。如果您倾向于编译从 GitHub 和其他地方提取的开源项目,这是一个很好的便利。
回答by Barney Govan
My guess is that the directory ~/bin/sbt/bin is not in your PATH.
我的猜测是目录 ~/bin/sbt/bin 不在您的 PATH 中。
To execute programs or scripts that are in the current directory you need to prefix the command with ./, as in:
要执行当前目录中的程序或脚本,您需要在命令前加上 ./,如下所示:
./sbt
This is a security feature in linux, so to prevent overriding of system commands (and other programs) by a malicious party dropping a file in your home directory (for example). Imagine a script called 'ls' that emails your /etc/passwd file to 3rd party before executing the ls command... Or one that executes 'rm -rf .'...
这是 linux 中的一项安全功能,因此可以防止恶意方覆盖您的主目录中的文件(例如)来覆盖系统命令(和其他程序)。想象一个名为“ls”的脚本,它在执行 ls 命令之前将您的 /etc/passwd 文件通过电子邮件发送给第 3 方...或者执行“rm -rf ...”的脚本...
That said, unless you need something specific from the latest source code, you're best off doing what paradigmatic said in his post, and install it from the Typesafe repository.
也就是说,除非您需要最新源代码中的特定内容,否则您最好按照他的帖子中的范式所说的去做,并从 Typesafe 存储库中安装它。

