Blackdown JDK is always slower than sun. It is too slow to update the Debian package. It is generated by unofficial Java-package. deb is not satisfactory, and some common commands are not added to the path. This article mainly refer to the Debian Java FAQ.
1. Obtain JDK.
Download the latest JDK 1.5 update2, http://java.sun.com from Sun's official website. Note: Download and decompress the version.
# Su Root
Switch to the Super User (you can also use sudo to obtain the Super User permission) and enter the download directory.
# Chmod A + x jdk-1_5_0_02-linux-i586.bin
#./Jdk-1_5_0_02-linux-i586.bin
Agree to the agreement. A jdk-1.5.0 directory will be obtained.
# Mkdir/usr/lib/j2se
# Mv jdk-1.5.0/usr/lib/j2se/5.0
# Cd/usr/lib
# Ln-S/usr/lib/j2se/5.0 Java
Edit the/etc/mailcap file and move the Java Web Start Settings to the top of the file. Otherwise, the custom settings will be washed out during Update-mime.
# ----- User section begins -----#
# ----- User section ends -----#
Changed:
# ----- User section begins -----#
# Java Web Start
Application/X-Java-JNLP-file;/usr/lib/Java/JRE/bin/javaws % s
# ----- User section ends -----#
2. Solve the system Java dependency.
Basically, it has been installed... The following solution solves the system dependency...
# Apt-Get install Java-common
At this time, detailed documents of Debian Java are available in/usr/share/doc/Java-common:
Debian-Java-FAQ
Debian-Java-Policy
# Cd/usr/share/doc/Java-Common/dummy-packages/
There are 5 files:
Java1-runtime-dummy.control
Java2-compiler-dummy.control
Java2-runtime-dummy.control
Java-compiler-dummy.control
Java-virtual-machine-dummy.control
First, make sure that equivs has been installed.
# Equivs-build java1-runtime-dummy.control
# Equivs-build java2-compiler-dummy.control
# Equivs-build java2-runtime-dummy.control
# Equivs-build java-compiler-dummy.control
# Equivs-build java-virtual-machine-dummy.control
Generate five. Deb package...
# Dpkg-I *. Deb
# Cp/usr/lib/Java/JRE/plugin/desktop/sun_java.desktop/usr/share/control-center-2.0/capplets/
Edit/usr/share/control-center-2.0/capplets/sun_java.desktop
Modify the Java path:
[Desktop entry] Name = Java Comment = Java Control Panel Exec =/usr/lib/Java/bin/controlpanel Icon =/usr/lib/Java/JRE/plugin/desktop/sun_java.png Terminal = 0 Type = Application Categories = application; settings; X-sun-supported; X-red-hat-base; |
In this way, you can start the Java console through the menu...
3. Use alternatives to run all Java commands, man, and plugin.
Finally, create a link for the command under JDK bin, install the plug-in for Mozilla, and create a shell file with the following content:
#! /Bin/bash Jdk_home =/usr/lib/JavaFor I in $ jdk_home/bin/*; do Altname = 'basename $ I' Echo "processing $ altname ..." Echo "" If [-X "$ I"-a-e "$ jdk_home/man/Man1/$. 1"] Then Update-alternatives -- verbose -- install/usr/bin/$ altname $ I 500 -- Slave/usr/share/man/Man1/$. 1 $. 1 $ jdk_home/man/Man1/$. 1 Else Update-alternatives -- verbose -- install/usr/bin/$ altname $ I 500 Fi Done Update-alternatives -- verbose -- install/usr/lib/Mozilla/plugins/libjavaplugin. So libjavaplugin. So $ jdk_home/JRE/plugin/i386/ns7/libjavaplugin_oji.so 500 # Update-alternatives -- install/usr/share/gnome/vfolders/settings/sun-java.desktop/usr/lib/Java/JRE/plugin/desktop/sun_java.desktop 500 |
# Sh your_shell
Test:
# Java-version
Output:
Java version "1.5.0"
Java (TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java hotspot (TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
# Man Java
You can check the usage of Java...
Write the first Java program and say hello to Java.
# File name: Hello. Java Hello class { Public static void main (string [] ARGs) { System. Out. println ("Hello, Java World! "); } } |
Compile the program:
# Javac hello. Java
Run the program:
# Java hello
Blocked output:
Hello, Java World!
Chinese problem, old topic, changing the font path.
See:
Http://www.linuxsir.org/bbs/showthread.php? S = & threadid = 124319 & Highlight = % BF % F2 % BF % F2
The script for deleting the Java environment link is attached:
#! /Bin/bash Jdk_home =/usr/lib/JavaFor I in $ jdk_home/bin/*; do Altname = 'basename $ I' Echo "processing $ altname ..." Echo "" If [-X "$ I"-a-e "$ jdk_home/man/Man1/$. 1"] Then Update-alternatives -- verbose -- remove-all $ altname Update-alternatives -- verbose -- remove-all $. 1 Else Update-alternatives -- verbose -- remove-all $ altname Fi Done Update-alternatives -- verbose -- remove-All libjavaplugin_oji.so # Update-alternatives -- verbose -- remove-All sun-java.desktop [Reproduced from http://blog.chinaunix.net/article.php? ArticleID = 2501 & blogid = 1096] |