在 Ubuntu 10.04 上安装 Java JDK
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3327497/
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
Installing Java JDK on Ubuntu 10.04
提问by NullUserException
Ever since I upgraded my Ubuntu from 9.10 to 10.04 I can't start Netbeans any more, because apparently they are dropping support for Java's JDK in favor of OpenJDK. Well, problem is, my IDEs won't work with OpenJDK.
自从我将 Ubuntu 从 9.10 升级到 10.04 后,我再也无法启动 Netbeans,因为显然他们正在放弃对 Java JDK 的支持,转而支持 OpenJDK。好吧,问题是,我的 IDE 不能与 OpenJDK 一起使用。
apt-get install sun-java6-jdkis not working. I downloaded the Linux installation file from Sun (jdk-6u21-linux-i586.bin) and installed it, but I can't call java or javac from the terminal.
apt-get install sun-java6-jdk不管用。我从Sun下载了Linux安装文件(jdk-6u21-linux-i586.bin)并安装了,但是在终端无法调用java或javac。
Can anyone help me here?
有人能帮我一下吗?
回答by Pablo Santa Cruz
回答by zengr
How to install Java6 JDK on Ubuntu 10.04
如何在 Ubuntu 10.04 上安装 Java6 JDK
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
回答by Devon_C_Miller
The NetBeans installation has a reference to the JDK that is created at install time. After the upgrade to 10.04, that reference is no longer valid.
NetBeans 安装引用了在安装时创建的 JDK。升级到 10.04 后,该引用不再有效。
Go to the directory where you installed NetBeans. By default it is "/usr/local/netbeans-version" if you installed as root or "$HOME/netbeans-version" if you installed as a regular user. There will be a subdirectory named "etc". In that directory, edit the "netbeans.conf" file. Look for the netbeans_jdk_homeand change it to /usr/lib/jvm/java-6-openjdk.
转到安装 NetBeans 的目录。默认情况下,如果您以 root 身份安装,则为“/usr/local/netbeans- version”;如果您以普通用户身份安装,则默认为“$HOME/netbeans- version”。将有一个名为“etc”的子目录。在该目录中,编辑“netbeans.conf”文件。查找netbeans_jdk_home并将其更改为/usr/lib/jvm/java-6-openjdk。
回答by Jesper
I downloaded the Linux installation file from Sun (jdk-6u21-linux-i586.bin) and installed it, but I can't call java or javac from the terminal.
我从Sun下载了Linux安装文件(jdk-6u21-linux-i586.bin)并安装了,但是在终端无法调用java或javac。
You missed the final step: after installing the JDK manually (instead of from the package system), you need to add the bindirectory of your JDK to the PATH. The best way to do that in Ubuntu 10.04 is to edit the file /etc/environment: sudo nano /etc/environment. Log out and back in and you should be able to run Java.
您错过了最后一步:手动安装 JDK(而不是从包系统)后,您需要将binJDK的目录添加到PATH. 在 Ubuntu 10.04 中执行此操作的最佳方法是编辑文件/etc/environment: sudo nano /etc/environment. 注销并重新登录,您应该能够运行 Java。
回答by Jeshurun
To run add-apt-repository, you need to install python-software-propertiesfirst. If you don't want to do this, you can:
要运行 add-apt-repository,您需要先安装python-software-properties。如果您不想这样做,您可以:
- Edit the sources.list file.
sudo nano /etc/apt/sources.list - Uncomment the lines
deb http://archive.canonical.com/ubuntu lucid partneranddeb-src http://archive.canonical.com/ubuntu lucid partner(they are the second set from teh bottom) sudo apt-get update- And finally,
sudo apt-get install sun-java6-jdk.
- 编辑sources.list 文件。
sudo nano /etc/apt/sources.list - 取消注释行
deb http://archive.canonical.com/ubuntu lucid partner和deb-src http://archive.canonical.com/ubuntu lucid partner(它们是从底部开始的第二组) sudo apt-get update- 最后,
sudo apt-get install sun-java6-jdk。
回答by Synchro
回答by Paramananda
If you are looking for Sun JDK on Ubuntu Visit following source.
如果您正在 Ubuntu 上寻找 Sun JDK,请访问以下来源。

