SDB:安装 Oracle Java
这篇文章将指导您在 openSUSE 上安装 Oracle Java。
现状
由于 Oracle(Sun)的许可证限制,openSUSE 官方软件源不再能够收纳 Java JRE。这是一个指导您安装快速安装 Oracle Java 的指南。
在Oracle Java 网站上有两个版本可供下载:
- Java Runtime Environment(JRE,Java 运行环境):包括了 Java 虚拟机、链接库、Java 应用程序启动器、网络浏览器和运行以 Java 语言编写的程序所需的所有东西。
- Java Development Kit(JDK,Java 开发套件):除了 JRE 所涵盖的东西外,它还包括了开发、测试和调试以 Java 语言编写的程序所需的全部工具。
对于普通用户(非开发者)而言,请安装 JRE,它能满足您运行任何 Java 程序的需求。对于开发者,请安装 JDK。
使用 Oracle 提供的 RPM 安装 JRE
这种安装方式的好处是快速和设置简单。你将不需要 Icedtea 网页插件,只使用 Java 官方的网页插件。推荐这种方式给那些一定要 Oracle Java 才能访问的网页的人。
在下载软件包前请确认您所运行的系统架构,打开一个终端(在 KDE 下按 F2 即可):konsole 或 gnome-terminal
执行命令:
若返回为:
i486 i586 i686
则您是 32 位系统
若返回为:
x86_64
则您是 64 位系统
从 Java.com 下载官方 RPM 并使用您喜欢的方式安装该 RPM。再次打开终端:
之后输入您的 root 密码,进入「超级用户」模式。 移动到下载位置,Firefox 或 Chrome 通常会下载到 ~/Downloads 中
输入下列命令进行安装:
安装完成后,再运行:
移除 icedtea-web 软件包。完成后,再运行下面命令:
update-alternatives --set java /usr/java/latest/bin/java
如果您运行后提示找不到 update-alternatives,请运行以下命令再执行之前的命令:
我们感兴趣的是 JRE 所带的 libnpjp2.so 这个文件(这个文件的位置取决于 openSUSE 和 JRE 的版本)。您可以使用 rpm 命令检查这个文件:
将返回该文件的绝对路径。您现在可以创建一个链接把它指向您的网页插件文件夹。可以 root 身份执行下面命令:
32 位架构:
64 位架构:
现在 Java 安装已经完成了,您可以运行与 Java 相关的程序了。
检查 Java 插件
若您想要看看官方 Java 插件是否安装正确,可重启浏览器并在地址栏中输入以下内容。 Firefox 请输入:
about:plugins
Chrome 或 Chromium 请输入:
chrome://plugins/
限制 Java 的磁盘使用量
虽然在菜单中找不到图标,但还是有一个 Java 控制面板可以让您简单地调整许多设置。要访问该面板,可以打开一个终端并输入:
- 点击网页临时文件下面的设置...
- 在磁盘空间下调整存储临时文件的磁盘用量到您想要的值,50 到 100 MB 应该足够。
- 点击 OK 来关闭对话框并再次点击 OK 来关闭 Java 控制面板
使用 Oracle 提供的 RPM 安装 JDK
下面教您如何安装完整的 Java 开发套件。
安装 Oracle Java SE
- 从 Oracle Java 网站下载 Oracle Java SE Development Kit (JDK)。保存到一个好记的文件夹(例如 /tmp)
- Linux x86 (32 位架构)
- jdk-7u7-linux-i586.tar.gz
- Linux x64 (64 位架构)
- jdk-7u7-linux-x64.tar.gz
- 打开一个终端并运行 cd /path/to/downloaded/java
- 解压缩:sudo tar -xzf ./jdk-7uX-linux-XX.tar.gz
- 修复解开的文件夹和内容的权限:sudo chown -R root:root jdk1.X.X_XX/
- Linux x86 (32 位架构)
- Open JDK 默认安装于 /usr/lib,所以我们把 Oracle Java 也移动到 /usr/lib:sudo mv ./jdk1.X.X_XX/ /usr/lib/
- 创建一个符号链接指向 /usr/lib/jdk1.X.X_XX/ (对于日后升级很重要): sudo ln -s -T /usr/lib/jdk1.X.X_XX/ /usr/lib/jdk_Oracle
- Linux x86_64 (64 位架构)
- Open JDK 默认安装于 /usr/lib64,所以我们把 Oracle Java 也移动到 /usr/lib64:sudo mv ./jdk1.X.X_XX/ /usr/lib64/
- 创建一个符号链接指向 /usr/lib64/jdk1.X.X_XX/ (对于日后升级很重要): sudo ln -s -T /usr/lib64/jdk1.X.X_XX/ /usr/lib64/jdk_Oracle
通知系统
Java 应用程序启动器
- 压缩 man 文件:
- Linux x86 (32 位架构)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/keytool.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/orbd.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/policytool.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/rmid.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/rmiregistry.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/servertool.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/tnameserv.1)
- Linux x86_64 (64 位架构)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/keytool.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/orbd.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/policytool.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmid.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmiregistry.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/servertool.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/tnameserv.1)
- 为 jvm-exports 准备文件夹 (1.7.0 特殊需要的):
- Linux x86 (32 位架构)
- sudo mkdir /usr/lib/jvm-exports/jdk_Oracle
cd /usr/lib/jvm-exports/jdk_Oracle
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar jaas-1.7.0_Orac.jar
sudo ln -s jaas-1.7.0_Orac.jar jaas-1.7.0.jar
sudo ln -s jaas-1.7.0_Orac.jar jaas.jar
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/jce.jar jce-1.7.0_Orac.jar
sudo ln -s jce-1.7.0_Orac.jar jce-1.7.0.jar
sudo ln -s jce-1.7.0_Orac.jar jce.jar
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar jdbc-stdext-1.7.0_Orac.jar
sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-1.7.0.jar
sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-3.0.jar
sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext.jar
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar jndi-1.7.0_Orac.jar
sudo ln -s jndi-1.7.0_Orac.jar jndi-1.7.0.jar
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar jndi-cos-1.7.0_Orac.jar
sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos-1.7.0.jar
sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos.jar
sudo ln -s jndi-1.7.0_Orac.jar jndi.jar
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar jndi-ldap-1.7.0_Orac.jar
sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap-1.7.0.jar
sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap.jar
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar jndi-rmi-1.7.0_Orac.jar
sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi-1.7.0.jar
sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi.jar
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/jsse.jar jsse-1.7.0_Orac.jar
sudo ln -s jsse-1.7.0_Orac.jar jsse-1.7.0.jar
sudo ln -s jsse-1.7.0_Orac.jar jsse.jar
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/rt.jar sasl-1.7.0_Orac.jar
sudo ln -s sasl-1.7.0_Orac.jar sasl-1.7.0.jar
sudo ln -s sasl-1.7.0_Orac.jar sasl.jar - sudo /usr/sbin/update-alternatives --install /usr/bin/java java /usr/lib/jdk_Oracle/bin/java 3 --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib/jdk_Oracle/man/man1/java.1.gz --slave /usr/lib/jvm/jre jre /usr/lib/jdk_Oracle/jre --slave /usr/lib/jvm-exports/jre jre_exports /usr/lib/jvm-exports/jdk_Oracle --slave /usr/bin/keytool keytool /usr/lib/jdk_Oracle/bin/keytool --slave /usr/share/man/man1/keytool.1.gz keytool.1.gz /usr/lib/jdk_Oracle/man/man1/keytool.1.gz --slave /usr/bin/orbd orbd /usr/lib/jdk_Oracle/bin/orbd --slave /usr/share/man/man1/orbd.1.gz orbd.1.gz /usr/lib/jdk_Oracle/man/man1/orbd.1.gz --slave /usr/bin/policytool policytool /usr/lib/jdk_Oracle/bin/policytool --slave /usr/share/man/man1/policytool.1.gz policytool.1.gz /usr/lib/jdk_Oracle/man/man1/policytool.1.gz --slave /usr/bin/rmid rmid /usr/lib/jdk_Oracle/bin/rmid --slave /usr/share/man/man1/rmid.1.gz rmid.1.gz /usr/lib/jdk_Oracle/man/man1/rmid.1.gz --slave /usr/bin/rmiregistry rmiregistry /usr/lib/jdk_Oracle/bin/rmiregistry --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/lib/jdk_Oracle/man/man1/rmiregistry.1.gz --slave /usr/bin/servertool servertool /usr/lib/jdk_Oracle/bin/servertool --slave /usr/share/man/man1/servertool.1.gz servertool.1.gz /usr/lib/jdk_Oracle/man/man1/servertool.1.gz --slave /usr/bin/tnameserv tnameserv /usr/lib/jdk_Oracle/bin/tnameserv --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/lib/jdk_Oracle/man/man1/tnameserv.1.gz
- Linux x86_64 (64 位架构)
- sudo mkdir /usr/lib64/jvm-exports/jdk_Oracle
cd /usr/lib64/jvm-exports/jdk_Oracle
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jaas-1.7.0_Orac.jar
sudo ln -s jaas-1.7.0_Orac.jar jaas-1.7.0.jar
sudo ln -s jaas-1.7.0_Orac.jar jaas.jar
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/jce.jar jce-1.7.0_Orac.jar
sudo ln -s jce-1.7.0_Orac.jar jce-1.7.0.jar
sudo ln -s jce-1.7.0_Orac.jar jce.jar
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jdbc-stdext-1.7.0_Orac.jar
sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-1.7.0.jar
sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-3.0.jar
sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext.jar
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-1.7.0_Orac.jar
sudo ln -s jndi-1.7.0_Orac.jar jndi-1.7.0.jar
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-cos-1.7.0_Orac.jar
sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos-1.7.0.jar
sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos.jar
sudo ln -s jndi-1.7.0_Orac.jar jndi.jar
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-ldap-1.7.0_Orac.jar
sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap-1.7.0.jar
sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap.jar
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-rmi-1.7.0_Orac.jar
sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi-1.7.0.jar
sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi.jar
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/jsse.jar jsse-1.7.0_Orac.jar
sudo ln -s jsse-1.7.0_Orac.jar jsse-1.7.0.jar
sudo ln -s jsse-1.7.0_Orac.jar jsse.jar
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar sasl-1.7.0_Orac.jar
sudo ln -s sasl-1.7.0_Orac.jar sasl-1.7.0.jar
sudo ln -s sasl-1.7.0_Orac.jar sasl.jar - sudo /usr/sbin/update-alternatives --install /usr/bin/java java /usr/lib64/jdk_Oracle/bin/java 3 --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib64/jdk_Oracle/man/man1/java.1.gz --slave /usr/lib64/jvm/jre jre /usr/lib64/jdk_Oracle/jre --slave /usr/lib64/jvm-exports/jre jre_exports /usr/lib64/jvm-exports/jdk_Oracle --slave /usr/bin/keytool keytool /usr/lib64/jdk_Oracle/bin/keytool --slave /usr/share/man/man1/keytool.1.gz keytool.1.gz /usr/lib64/jdk_Oracle/man/man1/keytool.1.gz --slave /usr/bin/orbd orbd /usr/lib64/jdk_Oracle/bin/orbd --slave /usr/share/man/man1/orbd.1.gz orbd.1.gz /usr/lib64/jdk_Oracle/man/man1/orbd.1.gz --slave /usr/bin/policytool policytool /usr/lib64/jdk_Oracle/bin/policytool --slave /usr/share/man/man1/policytool.1.gz policytool.1.gz /usr/lib64/jdk_Oracle/man/man1/policytool.1.gz --slave /usr/bin/rmid rmid /usr/lib64/jdk_Oracle/bin/rmid --slave /usr/share/man/man1/rmid.1.gz rmid.1.gz /usr/lib64/jdk_Oracle/man/man1/rmid.1.gz --slave /usr/bin/rmiregistry rmiregistry /usr/lib64/jdk_Oracle/bin/rmiregistry --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/lib64/jdk_Oracle/man/man1/rmiregistry.1.gz --slave /usr/bin/servertool servertool /usr/lib64/jdk_Oracle/bin/servertool --slave /usr/share/man/man1/servertool.1.gz servertool.1.gz /usr/lib64/jdk_Oracle/man/man1/servertool.1.gz --slave /usr/bin/tnameserv tnameserv /usr/lib64/jdk_Oracle/bin/tnameserv --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/lib64/jdk_Oracle/man/man1/tnameserv.1.gz
Java 编译器
- 压缩 man 文件:
- Linux x86 (32 位架构)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/apt.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/extcheck.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jar.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jarsigner.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/javac.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/javadoc.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/javah.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/javap.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jcmd.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jconsole.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jdb.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jhat.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jinfo.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jmap.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jps.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jrunscript.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jsadebugd.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jstack.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jstat.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/jstatd.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/native2ascii.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/pack200.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/rmic.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/schemagen.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/serialver.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/unpack200.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/wsgen.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/wsimport.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/xjc.1)
(准备 jvm-exports 文件夹,跟上面启动器那些是一样的。)
--slave /usr/bin/appletviewer appletviewer /usr/lib/jdk_Oracle/bin/appletviewer \
--slave /usr/share/man/man1/appletviewer.1.gz appletviewer.1.gz /usr/lib/jdk_Oracle/man/man1/appletviewer.1.gz \
--slave /usr/bin/apt apt /usr/lib/jdk_Oracle/bin/apt \
--slave /usr/share/man/man1/apt.1.gz apt.1.gz /usr/lib/jdk_Oracle/man/man1/apt.1.gz \
--slave /usr/bin/extcheck extcheck /usr/lib/jdk_Oracle/bin/extcheck \
--slave /usr/share/man/man1/extcheck.1.gz extcheck.1.gz /usr/lib/jdk_Oracle/man/man1/extcheck.1.gz \
--slave /usr/bin/jar jar /usr/lib/jdk_Oracle/bin/jar \
--slave /usr/share/man/man1/jar.1.gz jar.1.gz /usr/lib/jdk_Oracle/man/man1/jar.1.gz \
--slave /usr/bin/jarsigner jarsigner /usr/lib/jdk_Oracle/bin/jarsigner \
--slave /usr/share/man/man1/jarsigner.1.gz jarsigner.1.gz /usr/lib/jdk_Oracle/man/man1/jarsigner.1.gz \
--slave /usr/lib/jvm/java java_sdk /usr/lib/jdk_Oracle \
--slave /usr/lib/jvm-exports/java java_sdk_exports /usr/lib/jvm-exports/jdk_Oracle \
--slave /usr/share/man/man1/javac.1.gz javac.1.gz /usr/lib/jdk_Oracle/man/man1/javac.1.gz \
--slave /usr/bin/javadoc javadoc /usr/lib/jdk_Oracle/bin/javadoc \
--slave /usr/share/man/man1/javadoc.1.gz javadoc.1.gz /usr/lib/jdk_Oracle/man/man1/javadoc.1.gz \
--slave /usr/bin/javah javah /usr/lib/jdk_Oracle/bin/javah \
--slave /usr/share/man/man1/javah.1.gz javah.1.gz /usr/lib/jdk_Oracle/man/man1/javah.1.gz \
--slave /usr/bin/javap javap /usr/lib/jdk_Oracle/bin/javap \
--slave /usr/share/man/man1/javap.1.gz javap.1.gz /usr/lib/jdk_Oracle/man/man1/javap.1.gz \
--slave /usr/share/man/man1/jcmd.1.gz jcmd.1.gz /usr/lib/jdk_Oracle/man/man1/jcmd.1.gz \
--slave /usr/bin/jconsole jconsole /usr/lib/jdk_Oracle/bin/jconsole \
--slave /usr/share/man/man1/jconsole.1.gz jconsole.1.gz /usr/lib/jdk_Oracle/man/man1/jconsole.1.gz \
--slave /usr/bin/jdb jdb /usr/lib/jdk_Oracle/bin/jdb \
--slave /usr/share/man/man1/jdb.1.gz jdb.1.gz /usr/lib/jdk_Oracle/man/man1/jdb.1.gz \
--slave /usr/bin/jhat jhat /usr/lib/jdk_Oracle/bin/jhat \
--slave /usr/share/man/man1/jhat.1.gz jhat.1.gz /usr/lib/jdk_Oracle/man/man1/jhat.1.gz \
--slave /usr/bin/jinfo jinfo /usr/lib/jdk_Oracle/bin/jinfo \
--slave /usr/share/man/man1/jinfo.1.gz jinfo.1.gz /usr/lib/jdk_Oracle/man/man1/jinfo.1.gz \
--slave /usr/bin/jmap jmap /usr/lib/jdk_Oracle/bin/jmap \
--slave /usr/share/man/man1/jmap.1.gz jmap.1.gz /usr/lib/jdk_Oracle/man/man1/jmap.1.gz \
--slave /usr/bin/jps jps /usr/lib/jdk_Oracle/bin/jps \
--slave /usr/share/man/man1/jps.1.gz jps.1.gz /usr/lib/jdk_Oracle/man/man1/jps.1.gz \
--slave /usr/bin/jrunscript jrunscript /usr/lib/jdk_Oracle/bin/jrunscript \
--slave /usr/share/man/man1/jrunscript.1.gz jrunscript.1.gz /usr/lib/jdk_Oracle/man/man1/jrunscript.1.gz \
--slave /usr/bin/jsadebugd jsadebugd /usr/lib/jdk_Oracle/bin/jsadebugd \
--slave /usr/share/man/man1/jsadebugd.1.gz jsadebugd.1.gz /usr/lib/jdk_Oracle/man/man1/jsadebugd.1.gz \
--slave /usr/bin/jstack jstack /usr/lib/jdk_Oracle/bin/jstack \
--slave /usr/share/man/man1/jstack.1.gz jstack.1.gz /usr/lib/jdk_Oracle/man/man1/jstack.1.gz \
--slave /usr/bin/jstat jstat /usr/lib/jdk_Oracle/bin/jstat \
--slave /usr/share/man/man1/jstat.1.gz jstat.1.gz /usr/lib/jdk_Oracle/man/man1/jstat.1.gz \
--slave /usr/bin/jstatd jstatd /usr/lib/jdk_Oracle/bin/jstatd \
--slave /usr/share/man/man1/jstatd.1.gz jstatd.1.gz /usr/lib/jdk_Oracle/man/man1/jstatd.1.gz \
--slave /usr/bin/native2ascii native2ascii /usr/lib/jdk_Oracle/bin/native2ascii \
--slave /usr/share/man/man1/native2ascii.1.gz native2ascii.1.gz /usr/lib/jdk_Oracle/man/man1/native2ascii.1.gz \
--slave /usr/bin/pack200 pack200 /usr/lib/jdk_Oracle/bin/pack200 \
--slave /usr/share/man/man1/pack200.1.gz pack200.1.gz /usr/lib/jdk_Oracle/man/man1/pack200.1.gz \
--slave /usr/bin/rmic rmic /usr/lib/jdk_Oracle/bin/rmic \
--slave /usr/share/man/man1/rmic.1.gz rmic.1.gz /usr/lib/jdk_Oracle/man/man1/rmic.1.gz \
--slave /usr/bin/schemagen schemagen /usr/lib/jdk_Oracle/bin/schemagen \
--slave /usr/share/man/man1/schemagen.1.gz schemagen.1.gz /usr/lib/jdk_Oracle/man/man1/schemagen.1.gz \
--slave /usr/bin/serialver serialver /usr/lib/jdk_Oracle/bin/serialver \
--slave /usr/share/man/man1/serialver.1.gz serialver.1.gz /usr/lib/jdk_Oracle/man/man1/serialver.1.gz \
--slave /usr/bin/unpack200 unpack200 /usr/lib/jdk_Oracle/bin/unpack200 \
--slave /usr/share/man/man1/unpack200.1.gz unpack200.1.gz /usr/lib/jdk_Oracle/man/man1/unpack200.1.gz \
--slave /usr/bin/wsgen wsgen /usr/lib/jdk_Oracle/bin/wsgen \
--slave /usr/share/man/man1/wsgen.1.gz wsgen.1.gz /usr/lib/jdk_Oracle/man/man1/wsgen.1.gz \
--slave /usr/bin/wsimport wsimport /usr/lib/jdk_Oracle/bin/wsimport \
--slave /usr/share/man/man1/wsimport.1.gz wsimport.1.gz /usr/lib/jdk_Oracle/man/man1/wsimport.1.gz \
--slave /usr/bin/xjc xjc /usr/lib/jdk_Oracle/bin/xjc \
--slave /usr/share/man/man1/xjc.1.gz xjc.1.gz /usr/lib/jdk_Oracle/man/man1/xjc.1.gz
- Linux x86_64 (64 位架构)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/apt.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/extcheck.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jar.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jarsigner.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javac.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javadoc.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javah.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javap.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jcmd.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jconsole.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jdb.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jhat.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jinfo.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jmap.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jps.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jrunscript.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jsadebugd.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jstack.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jstat.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jstatd.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/native2ascii.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/pack200.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmic.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/schemagen.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/serialver.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/unpack200.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/wsgen.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/wsimport.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/xjc.1)
(准备 jvm-exports 文件夹,跟上面启动器那些是一样的。)
--slave /usr/bin/appletviewer appletviewer /usr/lib64/jdk_Oracle/bin/appletviewer \
--slave /usr/share/man/man1/appletviewer.1.gz appletviewer.1.gz /usr/lib64/jdk_Oracle/man/man1/appletviewer.1.gz \
--slave /usr/bin/apt apt /usr/lib64/jdk_Oracle/bin/apt \
--slave /usr/share/man/man1/apt.1.gz apt.1.gz /usr/lib64/jdk_Oracle/man/man1/apt.1.gz \
--slave /usr/bin/extcheck extcheck /usr/lib64/jdk_Oracle/bin/extcheck \
--slave /usr/share/man/man1/extcheck.1.gz extcheck.1.gz /usr/lib64/jdk_Oracle/man/man1/extcheck.1.gz \
--slave /usr/bin/jar jar /usr/lib64/jdk_Oracle/bin/jar \
--slave /usr/share/man/man1/jar.1.gz jar.1.gz /usr/lib64/jdk_Oracle/man/man1/jar.1.gz \
--slave /usr/bin/jarsigner jarsigner /usr/lib64/jdk_Oracle/bin/jarsigner \
--slave /usr/share/man/man1/jarsigner.1.gz jarsigner.1.gz /usr/lib64/jdk_Oracle/man/man1/jarsigner.1.gz \
--slave /usr/lib64/jvm/java java_sdk /usr/lib64/jdk_Oracle \
--slave /usr/lib64/jvm-exports/java java_sdk_exports /usr/lib64/jvm-exports/jdk_Oracle \
--slave /usr/share/man/man1/javac.1.gz javac.1.gz /usr/lib64/jdk_Oracle/man/man1/javac.1.gz \
--slave /usr/bin/javadoc javadoc /usr/lib64/jdk_Oracle/bin/javadoc \
--slave /usr/share/man/man1/javadoc.1.gz javadoc.1.gz /usr/lib64/jdk_Oracle/man/man1/javadoc.1.gz \
--slave /usr/bin/javah javah /usr/lib64/jdk_Oracle/bin/javah \
--slave /usr/share/man/man1/javah.1.gz javah.1.gz /usr/lib64/jdk_Oracle/man/man1/javah.1.gz \
--slave /usr/bin/javap javap /usr/lib64/jdk_Oracle/bin/javap \
--slave /usr/share/man/man1/javap.1.gz javap.1.gz /usr/lib64/jdk_Oracle/man/man1/javap.1.gz \
--slave /usr/share/man/man1/jcmd.1.gz jcmd.1.gz /usr/lib64/jdk_Oracle/man/man1/jcmd.1.gz \
--slave /usr/bin/jconsole jconsole /usr/lib64/jdk_Oracle/bin/jconsole \
--slave /usr/share/man/man1/jconsole.1.gz jconsole.1.gz /usr/lib64/jdk_Oracle/man/man1/jconsole.1.gz \
--slave /usr/bin/jdb jdb /usr/lib64/jdk_Oracle/bin/jdb \
--slave /usr/share/man/man1/jdb.1.gz jdb.1.gz /usr/lib64/jdk_Oracle/man/man1/jdb.1.gz \
--slave /usr/bin/jhat jhat /usr/lib64/jdk_Oracle/bin/jhat \
--slave /usr/share/man/man1/jhat.1.gz jhat.1.gz /usr/lib64/jdk_Oracle/man/man1/jhat.1.gz \
--slave /usr/bin/jinfo jinfo /usr/lib64/jdk_Oracle/bin/jinfo \
--slave /usr/share/man/man1/jinfo.1.gz jinfo.1.gz /usr/lib64/jdk_Oracle/man/man1/jinfo.1.gz \
--slave /usr/bin/jmap jmap /usr/lib64/jdk_Oracle/bin/jmap \
--slave /usr/share/man/man1/jmap.1.gz jmap.1.gz /usr/lib64/jdk_Oracle/man/man1/jmap.1.gz \
--slave /usr/bin/jps jps /usr/lib64/jdk_Oracle/bin/jps \
--slave /usr/share/man/man1/jps.1.gz jps.1.gz /usr/lib64/jdk_Oracle/man/man1/jps.1.gz \
--slave /usr/bin/jrunscript jrunscript /usr/lib64/jdk_Oracle/bin/jrunscript \
--slave /usr/share/man/man1/jrunscript.1.gz jrunscript.1.gz /usr/lib64/jdk_Oracle/man/man1/jrunscript.1.gz \
--slave /usr/bin/jsadebugd jsadebugd /usr/lib64/jdk_Oracle/bin/jsadebugd \
--slave /usr/share/man/man1/jsadebugd.1.gz jsadebugd.1.gz /usr/lib64/jdk_Oracle/man/man1/jsadebugd.1.gz \
--slave /usr/bin/jstack jstack /usr/lib64/jdk_Oracle/bin/jstack \
--slave /usr/share/man/man1/jstack.1.gz jstack.1.gz /usr/lib64/jdk_Oracle/man/man1/jstack.1.gz \
--slave /usr/bin/jstat jstat /usr/lib64/jdk_Oracle/bin/jstat \
--slave /usr/share/man/man1/jstat.1.gz jstat.1.gz /usr/lib64/jdk_Oracle/man/man1/jstat.1.gz \
--slave /usr/bin/jstatd jstatd /usr/lib64/jdk_Oracle/bin/jstatd \
--slave /usr/share/man/man1/jstatd.1.gz jstatd.1.gz /usr/lib64/jdk_Oracle/man/man1/jstatd.1.gz \
--slave /usr/bin/native2ascii native2ascii /usr/lib64/jdk_Oracle/bin/native2ascii \
--slave /usr/share/man/man1/native2ascii.1.gz native2ascii.1.gz /usr/lib64/jdk_Oracle/man/man1/native2ascii.1.gz \
--slave /usr/bin/pack200 pack200 /usr/lib64/jdk_Oracle/bin/pack200 \
--slave /usr/share/man/man1/pack200.1.gz pack200.1.gz /usr/lib64/jdk_Oracle/man/man1/pack200.1.gz \
--slave /usr/bin/rmic rmic /usr/lib64/jdk_Oracle/bin/rmic \
--slave /usr/share/man/man1/rmic.1.gz rmic.1.gz /usr/lib64/jdk_Oracle/man/man1/rmic.1.gz \
--slave /usr/bin/schemagen schemagen /usr/lib64/jdk_Oracle/bin/schemagen \
--slave /usr/share/man/man1/schemagen.1.gz schemagen.1.gz /usr/lib64/jdk_Oracle/man/man1/schemagen.1.gz \
--slave /usr/bin/serialver serialver /usr/lib64/jdk_Oracle/bin/serialver \
--slave /usr/share/man/man1/serialver.1.gz serialver.1.gz /usr/lib64/jdk_Oracle/man/man1/serialver.1.gz \
--slave /usr/bin/unpack200 unpack200 /usr/lib64/jdk_Oracle/bin/unpack200 \
--slave /usr/share/man/man1/unpack200.1.gz unpack200.1.gz /usr/lib64/jdk_Oracle/man/man1/unpack200.1.gz \
--slave /usr/bin/wsgen wsgen /usr/lib64/jdk_Oracle/bin/wsgen \
--slave /usr/share/man/man1/wsgen.1.gz wsgen.1.gz /usr/lib64/jdk_Oracle/man/man1/wsgen.1.gz \
--slave /usr/bin/wsimport wsimport /usr/lib64/jdk_Oracle/bin/wsimport \
--slave /usr/share/man/man1/wsimport.1.gz wsimport.1.gz /usr/lib64/jdk_Oracle/man/man1/wsimport.1.gz \
--slave /usr/bin/xjc xjc /usr/lib64/jdk_Oracle/bin/xjc \
--slave /usr/share/man/man1/xjc.1.gz xjc.1.gz /usr/lib64/jdk_Oracle/man/man1/xjc.1.gz
浏览器插件
- Linux x86 (32 位架构)
- Linux x86_64 (64 位架构)
将 Oracle Java 设为默认
再运行后您将需要选择合适的数字: (这也可以用于在不同的 Java 实现间切换)。
Java 应用程序启动器
Java 编译器
网页插件
设置特定于已安装的 Java 版本的选项
您甚至可以设置 Oracle Java 作为 JDK (和 JRE) 环境的候选,仅应用于某特殊版本的 Java,本例中是 1.7.0; 修改仍使用通常的 update-alternatives 来应用。
Java 应用程序启动器
- Linux x86 (32 位架构)
- Linux x86_64 (64 位架构)
选择您的候选 (全部架构):
Java 编译器
- Linux x86 (32 位架构)
- Linux x86_64 (64 位架构)
选择您的候选 (全部架构):
更新 Oracle Java
由于上面创建的 /usr/lib/jdk_Oracle (x86_64 上是 /usr/lib64/jdk_Oracle) 更新 Oracle Java 是非常简单的。
- Linux x86 (32 位架构)
1) 重复上面的流程来把 jdk1.X.X_XX 移动到 /usr/lib
2) 然后修改符号链接 /usr/lib/jdk_Oracle 指向新的 Java SE- Linux x86_64 (64-bit 位架构)
1) 重复上面的流程来把 jdk1.X.X_XX 移动到 /usr/lib64
2) 然后修改符号链接 /usr/lib64/jdk_Oracle 指向新的 Java SE3) 最后像上面描述的那样重新压缩 man 文件 (全部架构)。
添加 Java 控制面板
一旦你将 Oracle Java 设为了默认 jvm,你可能想要能够运行 /usr/lib/jdk_Oracle/bin/jcontrol
(若您运行的是 64 位系统则请把 lib 替换为 lib64),即使提供 Java 控制面板的应用程序可直接从您最爱的桌面环境下的应用程序菜单访问.
为了向应用程序菜单添加 "Java - Java 控制面板" 项,你需要创建一系列符号链接。当您想要移除 Oracle Java 时,您可以使用 sudo rm /path/to/your/symlink
删除它们。您可以使用以下命令创建这些符号链接,注意若您的系统是 64 位则 /usr/lib 必须替换为 /usr/lib64:
- Linux x86 (32 位架构)
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/desktop/icons/hicolor/16x16/apps/sun-jcontrol.png /usr/share/icons/hicolor/16x16/apps/
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png /usr/share/icons/hicolor/48x48/apps/
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/desktop/icons/LowContrast/16x16/apps/sun-jcontrol.png /usr/share/icons/locolor/16x16/apps/
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/desktop/icons/LowContrast/48x48/apps/sun-jcontrol.png /usr/share/icons/locolor/48x48/apps/
sudo ln -s /usr/lib/jdk_Oracle/jre/lib/desktop/applications/sun_java.desktop /usr/share/applications
- Linux x86_64 (64 位架构)
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/hicolor/16x16/apps/sun-jcontrol.png /usr/share/icons/hicolor/16x16/apps/
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png /usr/share/icons/hicolor/48x48/apps/
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/LowContrast/16x16/apps/sun-jcontrol.png /usr/share/icons/locolor/16x16/apps/
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/LowContrast/48x48/apps/sun-jcontrol.png /usr/share/icons/locolor/48x48/apps/
sudo ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/applications/sun_java.desktop /usr/share/applications
安装 JRE
仅安装 Java 运行环境。
安装 Oracle Java SE (JRE)
- 从 Oracle Java 网站下载 Oracle Java SE Runtime Environment (JRE)。保存到一个好记的文件夹 (例如 /tmp)
- Linux x86 (32 位架构)
- jre-7u7-linux-i586.tar.gz
- Linux x64 (64 位架构)
- jre-7u7-linux-x64.tar.gz
- 打开一个终端并运行: cd /path/to/downloaded/java
- 解压缩:sudo tar -xzf ./jre-7uX-linux-XX.tar.gz
- 修复解开的文件夹和内容的权限:sudo chown -R root:root jre1.X.X_XX/
- Linux x86 (32 位架构)
- Open JDK 默认安装于 /usr/lib,所以我们把 Oracle Java 也移动到 /usr/lib:sudo mv ./jre1.X.X_XX/ /usr/lib/
- 创建一个符号链接指向 /usr/lib/jdk1.X.X_XX/ (对于日后升级很重要):sudo ln -s -T /usr/lib/jre1.X.X_XX/ /usr/lib/jdk_Oracle
- Linux x86_64 (64 位架构)
- Open JDK 默认安装于 /usr/lib64,所以我们把 Oracle Java 也移动到 /usr/lib64:sudo mv ./jre1.X.X_XX/ /usr/lib64/
- 创建一个符号链接指向 /usr/lib64/jdk1.X.X_XX/ (对于日后升级很重要):sudo ln -s -T /usr/lib64/jre1.X.X_XX/ /usr/lib64/jdk_Oracle
通知系统 (JRE)
Java 应用程序启动器
- 压缩 man 文件:
- Linux x86 (32 位架构)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/keytool.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/orbd.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/policytool.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/rmid.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/rmiregistry.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/servertool.1)
sudo gzip $(readlink -f /usr/lib/jdk_Oracle/man/man1/tnameserv.1)
- Linux x86_64 (64 位架构)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/keytool.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/orbd.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/policytool.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmid.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmiregistry.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/servertool.1)
sudo gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/tnameserv.1)
- 为 jvm-exports 准备文件夹 (1.7.0 版本特殊需要的):
- Linux x86 (32 位架构)
- sudo mkdir /usr/lib/jvm-exports/jdk_Oracle
cd /usr/lib/jvm-exports/jdk_Oracle
sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar jaas-1.7.0_Orac.jar
sudo ln -s jaas-1.7.0_Orac.jar jaas-1.7.0.jar
sudo ln -s jaas-1.7.0_Orac.jar jaas.jar
sudo ln -s /usr/lib/jdk_Oracle/lib/jce.jar jce-1.7.0_Orac.jar
sudo ln -s jce-1.7.0_Orac.jar jce-1.7.0.jar
sudo ln -s jce-1.7.0_Orac.jar jce.jar
sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar jdbc-stdext-1.7.0_Orac.jar
sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-1.7.0.jar
sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-3.0.jar
sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext.jar
sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar jndi-1.7.0_Orac.jar
sudo ln -s jndi-1.7.0_Orac.jar jndi-1.7.0.jar
sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar jndi-cos-1.7.0_Orac.jar
sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos-1.7.0.jar
sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos.jar
sudo ln -s jndi-1.7.0_Orac.jar jndi.jar
sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar jndi-ldap-1.7.0_Orac.jar
sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap-1.7.0.jar
sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap.jar
sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar jndi-rmi-1.7.0_Orac.jar
sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi-1.7.0.jar
sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi.jar
sudo ln -s /usr/lib/jdk_Oracle/lib/jsse.jar jsse-1.7.0_Orac.jar
sudo ln -s jsse-1.7.0_Orac.jar jsse-1.7.0.jar
sudo ln -s jsse-1.7.0_Orac.jar jsse.jar
sudo ln -s /usr/lib/jdk_Oracle/lib/rt.jar sasl-1.7.0_Orac.jar
sudo ln -s sasl-1.7.0_Orac.jar sasl-1.7.0.jar
sudo ln -s sasl-1.7.0_Orac.jar sasl.jar - sudo /usr/sbin/update-alternatives --install /usr/bin/java java /usr/lib/jdk_Oracle/bin/java 3 --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib/jdk_Oracle/man/man1/java.1.gz --slave /usr/lib/jvm/jre jre /usr/lib/jdk_Oracle --slave /usr/lib/jvm-exports/jre jre_exports /usr/lib/jvm-exports/jdk_Oracle --slave /usr/bin/keytool keytool /usr/lib/jdk_Oracle/bin/keytool --slave /usr/share/man/man1/keytool.1.gz keytool.1.gz /usr/lib/jdk_Oracle/man/man1/keytool.1.gz --slave /usr/bin/orbd orbd /usr/lib/jdk_Oracle/bin/orbd --slave /usr/share/man/man1/orbd.1.gz orbd.1.gz /usr/lib/jdk_Oracle/man/man1/orbd.1.gz --slave /usr/bin/policytool policytool /usr/lib/jdk_Oracle/bin/policytool --slave /usr/share/man/man1/policytool.1.gz policytool.1.gz /usr/lib/jdk_Oracle/man/man1/policytool.1.gz --slave /usr/bin/rmid rmid /usr/lib/jdk_Oracle/bin/rmid --slave /usr/share/man/man1/rmid.1.gz rmid.1.gz /usr/lib/jdk_Oracle/man/man1/rmid.1.gz --slave /usr/bin/rmiregistry rmiregistry /usr/lib/jdk_Oracle/bin/rmiregistry --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/lib/jdk_Oracle/man/man1/rmiregistry.1.gz --slave /usr/bin/servertool servertool /usr/lib/jdk_Oracle/bin/servertool --slave /usr/share/man/man1/servertool.1.gz servertool.1.gz /usr/lib/jdk_Oracle/man/man1/servertool.1.gz --slave /usr/bin/tnameserv tnameserv /usr/lib/jdk_Oracle/bin/tnameserv --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/lib/jdk_Oracle/man/man1/tnameserv.1.gz
- Linux x86_64 (64 位架构)
- sudo mkdir /usr/lib64/jvm-exports/jdk_Oracle
cd /usr/lib64/jvm-exports/jdk_Oracle
sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar jaas-1.7.0_Orac.jar
sudo ln -s jaas-1.7.0_Orac.jar jaas-1.7.0.jar
sudo ln -s jaas-1.7.0_Orac.jar jaas.jar
sudo ln -s /usr/lib64/jdk_Oracle/lib/jce.jar jce-1.7.0_Orac.jar
sudo ln -s jce-1.7.0_Orac.jar jce-1.7.0.jar
sudo ln -s jce-1.7.0_Orac.jar jce.jar
sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar jdbc-stdext-1.7.0_Orac.jar
sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-1.7.0.jar
sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext-3.0.jar
sudo ln -s jdbc-stdext-1.7.0_Orac.jar jdbc-stdext.jar
sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar jndi-1.7.0_Orac.jar
sudo ln -s jndi-1.7.0_Orac.jar jndi-1.7.0.jar
sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar jndi-cos-1.7.0_Orac.jar
sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos-1.7.0.jar
sudo ln -s jndi-cos-1.7.0_Orac.jar jndi-cos.jar
sudo ln -s jndi-1.7.0_Orac.jar jndi.jar
sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar jndi-ldap-1.7.0_Orac.jar
sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap-1.7.0.jar
sudo ln -s jndi-ldap-1.7.0_Orac.jar jndi-ldap.jar
sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar jndi-rmi-1.7.0_Orac.jar
sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi-1.7.0.jar
sudo ln -s jndi-rmi-1.7.0_Orac.jar jndi-rmi.jar
sudo ln -s /usr/lib64/jdk_Oracle/lib/jsse.jar jsse-1.7.0_Orac.jar
sudo ln -s jsse-1.7.0_Orac.jar jsse-1.7.0.jar
sudo ln -s jsse-1.7.0_Orac.jar jsse.jar
sudo ln -s /usr/lib64/jdk_Oracle/lib/rt.jar sasl-1.7.0_Orac.jar
sudo ln -s sasl-1.7.0_Orac.jar sasl-1.7.0.jar
sudo ln -s sasl-1.7.0_Orac.jar sasl.jar - sudo /usr/sbin/update-alternatives --install /usr/bin/java java /usr/lib64/jdk_Oracle/bin/java 3 --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib64/jdk_Oracle/man/man1/java.1.gz --slave /usr/lib64/jvm/jre jre /usr/lib64/jdk_Oracle --slave /usr/lib64/jvm-exports/jre jre_exports /usr/lib64/jvm-exports/jdk_Oracle --slave /usr/bin/keytool keytool /usr/lib64/jdk_Oracle/bin/keytool --slave /usr/share/man/man1/keytool.1.gz keytool.1.gz /usr/lib64/jdk_Oracle/man/man1/keytool.1.gz --slave /usr/bin/orbd orbd /usr/lib64/jdk_Oracle/bin/orbd --slave /usr/share/man/man1/orbd.1.gz orbd.1.gz /usr/lib64/jdk_Oracle/man/man1/orbd.1.gz --slave /usr/bin/policytool policytool /usr/lib64/jdk_Oracle/bin/policytool --slave /usr/share/man/man1/policytool.1.gz policytool.1.gz /usr/lib64/jdk_Oracle/man/man1/policytool.1.gz --slave /usr/bin/rmid rmid /usr/lib64/jdk_Oracle/bin/rmid --slave /usr/share/man/man1/rmid.1.gz rmid.1.gz /usr/lib64/jdk_Oracle/man/man1/rmid.1.gz --slave /usr/bin/rmiregistry rmiregistry /usr/lib64/jdk_Oracle/bin/rmiregistry --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/lib64/jdk_Oracle/man/man1/rmiregistry.1.gz --slave /usr/bin/servertool servertool /usr/lib64/jdk_Oracle/bin/servertool --slave /usr/share/man/man1/servertool.1.gz servertool.1.gz /usr/lib64/jdk_Oracle/man/man1/servertool.1.gz --slave /usr/bin/tnameserv tnameserv /usr/lib64/jdk_Oracle/bin/tnameserv --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/lib64/jdk_Oracle/man/man1/tnameserv.1.gz
浏览器插件
- Linux x86 (32 位架构)
- Linux x86_64 (64 位架构)
将 Oracle Java 设为默认 (JRE)
再运行后您将需要选择合适的数字: (这也可以用于在不同的 Java 实现间切换)。
Java 应用程序启动器
浏览器插件
设置特定于已安装的 Java JRE 版本的选项
您甚至可以设置 Oracle Java 作为 JRE 环境的候选,仅应用于某特殊版本的 Java,本例中是 1.7.0; 修改仍使用通常的 update-alternatives 来应用。
Java 应用程序启动器
- Linux x86 (32 位架构)
- Linux x86_64 (64 位架构)
选择您的候选 (全部架构):
更新 Oracle Java (JRE)
由于上面创建的链接 /usr/lib/jdk_Oracle (x86_64 上是 /usr/lib64/jdk_Oracle),更新 Oracle Java 是非常简单的。
- Linux x86 (32 位架构)
1) 重复上面的流程来把 jre1.X.X_XX 移动到 /usr/lib
2) 然后修改符号链接 /usr/lib/jdk_Oracle 来指向新的 Java SE- Linux x86_64 (64 位架构)
1) 重复上面的流程来把 jre1.X.X_XX 移动到 /usr/lib64
2) 然后修改符号链接 /usr/lib64/jdk_Oracle 来指向新的 Java SE3) 最后像上面描述的那样重新压缩 man 文件 (全部架构)。
添加 Java 控制面板 (JRE)
一旦你将 Oracle Java 设为了默认 jvm,你可能想要能够运行 /usr/lib/jdk_Oracle/bin/jcontrol
(若您运行的是 64 位系统则请把 lib 替换为 lib64),即使提供 Java 控制面板的应用程序可直接从您最爱的桌面环境下的应用程序菜单访问.
为了向应用程序菜单添加 "Java - Java 控制面板" 项,你需要创建一系列符号链接。当您想要移除 Oracle Java 时,您可以使用 sudo rm /path/to/your/symlink
删除它们。您可以使用以下命令创建这些符号链接,注意若您的系统是 64 位则 /usr/lib 必须替换为 /usr/lib64:
- Linux x86 (32 位架构)
sudo ln -s /usr/lib/jdk_Oracle/lib/desktop/icons/hicolor/16x16/apps/sun-jcontrol.png /usr/share/icons/hicolor/16x16/apps/
sudo ln -s /usr/lib/jdk_Oracle/lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png /usr/share/icons/hicolor/48x48/apps/
sudo ln -s /usr/lib/jdk_Oracle/lib/desktop/icons/LowContrast/16x16/apps/sun-jcontrol.png /usr/share/icons/locolor/16x16/apps/
sudo ln -s /usr/lib/jdk_Oracle/lib/desktop/icons/LowContrast/48x48/apps/sun-jcontrol.png /usr/share/icons/locolor/48x48/apps/
sudo ln -s /usr/lib/jdk_Oracle/lib/desktop/applications/sun_java.desktop /usr/share/applications/
- Linux x86_64 (64 位架构)
sudo ln -s /usr/lib64/jdk_Oracle/lib/desktop/icons/hicolor/16x16/apps/sun-jcontrol.png /usr/share/icons/hicolor/16x16/apps/
sudo ln -s /usr/lib64/jdk_Oracle/lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png /usr/share/icons/hicolor/48x48/apps/
sudo ln -s /usr/lib64/jdk_Oracle/lib/desktop/icons/LowContrast/16x16/apps/sun-jcontrol.png /usr/share/icons/locolor/16x16/apps/
sudo ln -s /usr/lib64/jdk_Oracle/lib/desktop/icons/LowContrast/48x48/apps/sun-jcontrol.png /usr/share/icons/locolor/48x48/apps/
sudo ln -s /usr/lib64/jdk_Oracle/lib/desktop/applications/sun_java.desktop /usr/share/applications/
相关文档
外部链接
- Setup Sun JDK on openSUSE
- Easy Linux Tips Project, Oracle (Sun) Java for openSUSE and Fedora
- JDK Installer - Bash Script