Linux Ubuntu 上的 SCALA_HOME 在哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15773293/
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
Where is SCALA_HOME on Ubuntu?
提问by Soumya Simanta
I installed Scala on Ubuntu using the following
我使用以下方法在 Ubuntu 上安装了 Scala
sudo apt-get install scala
~$ which scala
/usr/bin/scala
~$ whereis scala
scala: /usr/bin/scala /usr/bin/X11/scala /usr/share/man/man1/scala.1.gz
~$ scala -version
Scala code runner version 2.9.1 -- Copyright 2002-2011, LAMP/EPFL
My question is what should I put in the variable SCALA_HOME? /usr/bin ?
我的问题是我应该在变量 SCALA_HOME 中放入什么?/usr/bin ?
采纳答案by Soumya Simanta
As of today I couldn't find an easy (and reliable) way of setting this.
截至今天,我找不到一种简单(可靠)的方法来设置它。
As per Alex (in the comment above) installing from tarball (downloaded from scala-lang.org) into /location/of/scala/untar
根据 Alex(在上面的评论中)从 tarball(从 scala-lang.org 下载)安装到 /location/of/scala/untar
Then I set export SCALA_HOME=/location/of/scala/untar
in my .bashrc
Everything works for now!
然后我现在设置export SCALA_HOME=/location/of/scala/untar
我的.bashrc
一切工作!
回答by Seraph
The SCALA_HOME should be the directory where you install scala from. For example, the name of this directory may be scala-2.9.2.
SCALA_HOME 应该是您安装 scala 的目录。例如,该目录的名称可能是 scala-2.9.2。
回答by Tim Perry
Today I installed scala using "apt-get install scala" and confirmed the scala jar files are located in /usr/share/java
今天我使用“apt-get install scala”安装了scala并确认scala jar文件位于 /usr/share/java
You should be able to set your SCALA_HOME
to /usr/share/java
and have it all work. I assume you want to use NetBeans so you will need to set SCALA_HOME in your .profile (or .bash_profile) rather than in your .bashrc because NetBeans won't see any variables set in your .bashrc unless you start it from the command line
你应该能够设置你的SCALA_HOME
,/usr/share/java
并让它全部工作。我假设您想使用 NetBeans,因此您需要在 .profile(或 .bash_profile)而不是 .bashrc 中设置 SCALA_HOME,因为除非您从命令行启动,否则 NetBeans 不会看到 .bashrc 中设置的任何变量
$ find / -maxdepth 6 -iname \*scala\*jar 2> /dev/null
/usr/share/java/scala-dbc.jar
/usr/share/java/scala-partest.jar
/usr/share/java/scala-partest-2.9.1.jar
/usr/share/java/scala-dbc-2.9.1.jar
/usr/share/java/scalacheck.jar
/usr/share/java/scalap.jar
/usr/share/java/scala-library-2.9.1.jar
/usr/share/java/scala-compiler-2.9.1.jar
/usr/share/java/scala-library.jar
/usr/share/java/scalacheck-2.9.1.jar
/usr/share/java/scala-compiler.jar
/usr/share/java/scala-swing-2.9.1.jar
/usr/share/java/scalap-2.9.1.jar
/usr/share/java/scala-swing.jar
回答by Jeremy
For me its: /usr/share/java/scala
I determined this by doing
dpkg -L scala
对我来说:/usr/share/java/scala
我通过这样做来确定这一点
dpkg -L scala
This assumes you install scala using APT.
这假设您使用 APT 安装 scala。
回答by user4452661
If you have installed Scala using
如果你已经安装了 Scala 使用
$apt-get install scala
$apt-get install scala
then, after a successful install to see where it installed, run
然后,在成功安装后查看安装位置,运行
which scala
If this command shows you the path to scala binaries. Now run
如果此命令向您显示了 Scala 二进制文件的路径。现在运行
pwd
Now export SCALA_HOME path into either of these environment files
现在将 SCALA_HOME 路径导出到这些环境文件中的任何一个
~/.bashrc
~/.bashrc
or
或者
/etc/profile
/etc/配置文件
export SCALA_HOME=<output of pwd>
回答by DataGuru
I had the same issue and I did some digging This takes into account that you are using sudo dpkg -i scala-2.11.4.deb; where the debian package has been downloaded
我有同样的问题,我做了一些挖掘这考虑到你正在使用 sudo dpkg -i scala-2.11.4.deb; 已下载 debian 软件包的位置
The SCALA_HOME should be /usr/share/scala; This is based on the following
SCALA_HOME 应该是 /usr/share/scala;这是基于以下几点
- /usr/bin/scala is a symbolic link to /usr/share/scala/bin/scala
- /usr/bin/X11/scala is also a symbolic link to /usr/share/scala/bin/scala
- /usr/bin/scala 是 /usr/share/scala/bin/scala 的符号链接
- /usr/bin/X11/scala 也是 /usr/share/scala/bin/scala 的符号链接
The way I see the scala package is installed in /usr/share/scala which should be your SCALA_HOME
我看到 scala 包安装在 /usr/share/scala 的方式应该是你的 SCALA_HOME
回答by wayneeusa
I installed the untarred scala into /usr/local/share
as it is on the scala download site.
我/usr/local/share
在 scala 下载站点上安装了未压缩的 scala 。
In my .bashrc
, I placed the following line:
在我的 中.bashrc
,我放置了以下行:
export PATH="/usr/local/share/scala-2.11.8/bin:$PATH"
works great from terminal regardless of what directory I'm in.
无论我在哪个目录中,终端都可以很好地工作。