我想在手动安装Java的Ubuntu机器上安装sbt。我使用以下代码在机器上手动安装Java:
sudo curl -L -s http://wake.s3.amazonaws.com/blobs/jdk-7u51-linux-x64.gz -o /usr/local/jdk-oracle.gz
cd /usr/local
sudo tar xzf /usr/local/jdk-oracle.gz
sudo rm -rf usr/local/jdk-oracle.gz
export JAVA_HOME=/usr/local/jdk1.7.0_51
export PATH=$PATH:$JAVA_HOME/bin
echo "export JAVA_HOME=/usr/local/jdk1.7.0_51" | sudo tee -a /etc/profile
echo "PATH=$PATH:$JAVA_HOME/bin" | sudo tee -a /etc/profile
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/jdk1.7.0_51/bin/java" 1
使用
下载并安装sbt时curl -o /tmp/sbt.deb http://scalasbt.artifactoryonline.com/scalasbt/sbt-native-packages/org/scala-sbt/sbt//0.13.0/sbt.deb
sudo dpkg -i /tmp/sbt.deb
会抛出以下错误:
dpkg: dependency problems prevent configuration of sbt:
sbt depends on java2-runtime; however:
Package java2-runtime is not installed.
dpkg: error processing sbt (--install):
dependency problems - leaving unconfigured
Processing triggers for man-db ...
Errors were encountered while processing:
sbt
不能通过webpd8 PPA安装java。我也看了一下区分安装JRE和JDK的手册(http://www.wikihow.com/Install-Oracle-Java-on-Ubuntu-Linux),但是仍然找不到java2-runtime。如何在Ubuntu上手动安装Java来安装sbt ?
(从上面的评论中重新发布这个作为答案,因为它可以解决问题)
也有手动安装SBT的选项(参见这里的Unix),这应该不会太难。