Ubuntu 10.04 LTS 安装 sun-java6-jdk ,出现错误。
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package sun-java6-jdk 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 sun-java6-jdk has no installation candidate
说是Ubuntu 10.04已经去掉 sun-java6-jdk 和 sun-java6-jre的软件包
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
错误提示还是一样:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package sun-java6-jdk 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 sun-java6-jdk has no installation candidate
这些都干过了。也查了源列表。。也有http://archive.canonical.com/ lucid partner,并且有了好几个。
求解。。。。
自己回答:
在更新apt源头sudo apt-get update时出现如下提示:
Ign http://extras.ubuntu.com oneiric/main Translation-en_US
Ign http://archive.canonical.com lucid/partner Translation-en_US
Ign http://archive.canonical.com lucid/partner Translation-en
Ign http://extras.ubuntu.com oneiric/main Translation-en
Ign http://us.archive.ubuntu.com jaunty/multiverse TranslationIndex
Ign http://us.archive.ubuntu.com jaunty-updates/multiverse TranslationIndex
Ign http://archive.canonical.com natty/partner Translation-en_US
Ign http://archive.canonical.com natty/partner Translation-en
Hit http://us.archive.ubuntu.com oneiric/main Translation-en
Hit http://us.archive.ubuntu.com oneiric/multiverse Translation-en
Hit http://us.archive.ubuntu.com oneiric/restricted Translation-en
Hit http://us.archive.ubuntu.com oneiric/universe Translation-en
Hit http://us.archive.ubuntu.com oneiric-updates/main Translation-en
Hit http://us.archive.ubuntu.com oneiric-updates/multiverse Translation-en
Hit http://us.archive.ubuntu.com oneiric-updates/restricted Translation-en
Hit http://us.archive.ubuntu.com oneiric-updates/universe Translation-en
Hit http://us.archive.ubuntu.com oneiric-backports/main Translation-en
Hit http://us.archive.ubuntu.com oneiric-backports/multiverse Translation-en
Hit http://us.archive.ubuntu.com oneiric-backports/restricted Translation-en
Hit http://us.archive.ubuntu.com oneiric-backports/universe Translation-en
Err http://us.archive.ubuntu.com jaunty/multiverse Sources
404 Not Found [IP: 91.189.92.180 80]
Err http://us.archive.ubuntu.com jaunty/multiverse amd64 Packages
404 Not Found [IP: 91.189.92.180 80]
Err http://us.archive.ubuntu.com jaunty/multiverse i386 Packages
404 Not Found [IP: 91.189.92.180 80]
Err http://us.archive.ubuntu.com jaunty-updates/multiverse Sources
404 Not Found [IP: 91.189.92.180 80]
Err http://us.archive.ubuntu.com jaunty-updates/multiverse amd64 Packages
404 Not Found [IP: 91.189.92.180 80]
Err http://us.archive.ubuntu.com jaunty-updates/multiverse i386 Packages
404 Not Found [IP: 91.189.92.180 80]
Ign http://us.archive.ubuntu.com jaunty/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com jaunty/multiverse Translation-en
Ign http://us.archive.ubuntu.com jaunty-updates/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com jaunty-updates/multiverse Translation-en
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/multiverse/source/Sources 404 Not Found [IP: 91.189.92.180 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/multiverse/binary-amd64/Packages 404 Not Found [IP: 91.189.92.180 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.92.180 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty-updates/multiverse/source/Sources 404 Not Found [IP: 91.189.92.180 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty-updates/multiverse/binary-amd64/Packages 404 Not Found [IP: 91.189.92.180 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty-updates/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.92.180 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
但是。。。
cc@ubuntu:~$ sudo apt-get install sun-java6-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package sun-java6-jdk 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 'sun-java6-jdk' has no installation candidate
???
然后去学习一下下载的是什么东西··
JDK
JDK 是整个Java的核心,包括了Java运行环境(Java Runtime Envirnment),一堆Java工具和Java基础的类库(rt.jar)。不论什么Java应用服务器实质都是内置了某个版本的JDK.最主流的JDK是Sun公司发布的JDK,除了Sun之外,还有很多公司和组织都开发了自己的JDK,例如IBM公司开发的JDK,BEA公司的Jrocket,还有GNU组织开发的JDK等等。其中IBM的JDK包含的JVM(Java Virtual Machine)运行效率要比Sun JDK包含的JVM高出许多。而专门运行在x86平台的Jrocket在服务端运行效率也要比Sun JDK好很多。但不管怎么说,我们还是需要先把Sun JDK掌握好。
JDK一般有三种版本:SE(J2SE),standard edition,标准版,是我们通常用的一个版本EE(J2EE),enterpsise edtion,企业版,使用这种JDK开发J2EE应用程序,ME(J2ME),micro edtion,主要用于移动设备、嵌入式设备上的java应用程序Java开发工具(JDK)是许多Java专家最初使用的开发环境。尽管许多编程人员已经使用第三方的开发工具,但JDK仍被当作Java开发的重要工具。JDK由一个标准类库和一组建立,测试及建立文档的Java实用程序组成。其核心Java API是一些预定义的类库,开发人员需要用这些类来访问Java语言的功能。Java API包括一些重要的语言结构以及基本图形,网络和文件I/O.一般来说,Java API的非I/O部分对于运行Java的所有平台是相同的,而I/O部分则仅在通用Java环境中实现。
作为JDK实用程序,工具库中有七种主要程序。
◆Javac:Java编译器,将Java源代码转换成字节码。
◆Java:Java解释器,直接从类文件执行Java应用程序字节代码。
◆appletviewer:小程序浏览器,一种执行HTML文件上的Java小程序的Java浏览器。
◆Javadoc:根据Java源码及说明语句生成HTML文档。
◆Jdb:Java调试器,可以逐行执行程序,设置断点和检查变量。
◆Javah:产生可以调用Java过程的C过程,或建立能被Java程序调用的C过程的头文件。
◆Javap:Java反汇编器,显示编译类文件中的可访问功能和数据,同时显示字节代码含义。
JRE
JRE(Java Runtime Environment,Java运行环境),运行JAVA程序所必须的环境的集合,包含JVM标准实现及Java核心类库。是Sun的产品,包括两部分:JavaRuntimeEnvironment和JavaPlug-inJavaRuntimeEnvironment(JRE)是可以在其上运行、测试和传输应用程序的Java平台。它包括Java虚拟机、Java平台核心类和支持文件。它不包含开发工具——编译器、调试器和其它工具。JRE需要辅助软件 ——JavaPlug-in——以便在浏览器中运行applet.J2RE是Java2 Runtime Environment,即Java运行环境,有时简称JRE.如果你只需要运行Java程序或Applet,下载并安装它即可。如果你要自行开发 Java软件,请下载JDK.在JDK中附带有JRE.注意由于Microsoft对Java的支持不完全,请不要使用IE自带的虚拟机来运行 Applet,务必安装一个JRE或JDK.
最后实现办法
1、添加这个源:
deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse。
方法:
sudo gedit /etc/apt/sources.list
打开源列表,在最后一行添加
deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse。保存退出。
2、sudo apt-get update
3、sudo apt-get install sun-java6-jdk
当出现:
The following NEW packages will be installed:
gsfonts-x11 java-common odbcinst odbcinst1debian1 sun-java6-bin
sun-java6-jdk sun-java6-jre unixodbc
0 upgraded, 8 newly installed, 0 to remove and 460 not upgraded.
Need to get 43.6MB of archives.
After this operation, 131MB of additional disk space will be used.
Do you want to continue [Y/n]? y
恭喜你,可以安装了,
然后就会出现下载安装sun-java6-jdk。。。有点久 当下载完成时,就会有
说明成功了。^_^