我正在尝试在我的ubuntu上安装openjdk-7但是我收到以下错误:
$ sudo apt-get install openjdk-7-jre
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package openjdk-7-jre is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package openjdk-7-jre has no installation candidate
我想我错过了一些回购或类似的东西,但我无法找到任何参考地点和内容。
答案 0 :(得分:13)
我最近不得不在CentOS,openSUSE和Ubuntu上安装Java 7,经过多次烦恼和研究后,终于确定了这个,这适用于所有三种风格:
显然,你必须在这里填写一些空白,但你应该了解情况。作为一个工作示例,这是我的安装(注意,为了我的目的,我需要Java 7和Java 6 JDK的64位和32位版本,所以有很多):
# ls -al /usr/java/
total 24
drwxr-xr-x 6 root root 4096 Sep 2 11:02 .
drwxr-xr-x 14 root root 4096 Aug 9 22:14 ..
lrwxrwxrwx 1 root root 16 Aug 26 20:05 default -> /usr/java/latest
drwxr-xr-x 8 root root 4096 Sep 2 10:52 jdk1.6.0_35
drwxr-xr-x 8 root root 4096 Sep 2 10:52 jdk1.6.0_35-32
drwxr-xr-x 8 root root 4096 Sep 2 10:52 jdk1.7.0_07
drwxr-xr-x 8 root root 4096 Sep 2 10:52 jdk1.7.0_07-32
lrwxrwxrwx 1 root root 11 Sep 2 10:54 jdk6 -> jdk1.6.0_35
lrwxrwxrwx 1 root root 14 Sep 2 10:54 jdk6-32 -> jdk1.6.0_35-32
lrwxrwxrwx 1 root root 11 Sep 2 10:54 jdk7 -> jdk1.7.0_07
lrwxrwxrwx 1 root root 14 Sep 2 10:54 jdk7-32 -> jdk1.7.0_07-32
lrwxrwxrwx 1 root root 4 Sep 2 10:55 latest -> jdk7
# ls -al /usr/bin/java*
lrwxrwxrwx 1 root root 26 Aug 26 20:05 /usr/bin/java -> /usr/java/default/bin/java
lrwxrwxrwx 1 root root 27 Aug 26 20:05 /usr/bin/javac -> /usr/java/default/bin/javac
lrwxrwxrwx 1 root root 29 Aug 26 20:05 /usr/bin/javadoc -> /usr/java/default/bin/javadoc
lrwxrwxrwx 1 root root 27 Aug 26 20:07 /usr/bin/javah -> /usr/java/default/bin/javah
lrwxrwxrwx 1 root root 28 Aug 26 20:05 /usr/bin/javaws -> /usr/java/default/bin/javaws
# java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
答案 1 :(得分:4)
在ubuntu lucid 64位上,我需要将此链接添加到链中:
ln -s /usr/java/latest /usr/java/default
答案 2 :(得分:3)
甲骨文对Java有限制的限制方式就是好的。我认为openjdk非常好。在像Ubuntu这样的debian系统上安装它是无痛的。请使用apt-get这样:
$ sudo apt-get update
$ sudo apt-get install openjdk-7-jdk
如果您的apt-get缓存/元数据未使用存储库更新包含openjdk-7的最新更改,则需要更新。除非您的发行版不是很老,否则pacakge openjdk-7-jre的逻辑安装也应该有效。