Organize: lazy cat [steencat at 126.com], which was organized on July 6, October 14, 2005.
From: linuxsir. org
Abstract: many users want to use Sun Java JDK/JRE to run and debug Java applications instead of the built-in and default Java Virtual Machine gcj. Program . This article will solve this problem for you.
Applicable release: Use gcj as the default Java environment release, such as Fedora Core 4
Primary Content Index
- Place Java
- Create shortcuts to replace gcj
- Configure Environment Variables
- Optimize Chinese display
- Configure browser plug-ins
- Java console call
1. Download JDK
1. Download
You can find the latest JDK from here:Http://java.sun.com/
Download the corresponding version based on your machine, suchJdk-1_5_0_05-linux-i586.bin
This is the sh self-extracting execution script of j2se Development Kit 1.5 Update 5 for Linux. The package has been installed.
2. Release the Software Package
View All files in the current directory[Root @ localhost sunjava] # ls
Jre-1_5_0_04-linux-i586.bin
Execute the sh self-extracting script[Root @ localhost sunjava] # sh jre-1_5_0_04-linux-i586.bin
Do you agree to the above license terms? [Yes or No] Yes
View All files in the current directory again[Root @ localhost sunjava] # ls
Jre-1_5_0_04-linux-i586.bin jre1.5.0 _ 04
In fact, the sh script will release a folder named jdk1.5.0 _ 05 to the current directory.
2. Configure the Java compiling and running environment
1. Place Java
Move or copy the jdk1.5.0 _ 05 folder to the/usr/local directory.[Root @ localhost sunjava] # mv jdk1.5.0 _ 05/usr/local/
2. Create shortcuts to replace gcj
Create shortcuts (static links) for Java and javac to replace gcj.# Cd/usr/bin
# Ln-S-F/usr/local/jdk1.5.0 _ 05/JRE/bin/Java
# Ln-S-F/usr/local/jdk1.5.0 _ 05/bin/javac
The-F parameter of the ln command is used to forcibly overwrite the existing/usr/local/Java static link file. Because the bin in the JDK directory
The folder content can replace/jdk1.5.0 _ 05/JRE/bin, so you can directly use the/jdk1.5.0 _ 05/bin path.
Note: gcj is not permanently deleted from your computer. You can still find it using the whereis gcj command and use it as needed.
3. Configure Environment Variables
Method 1: personalized configuration of independent end users
Edit the. bashrc of the current user, that is:$ Gedit ~ /. Bashrc
Or# Gedit/home/xxxx/. bashrc
Add the following five elements:Java_home =/usr/local/jdk1.5.0 _ 05
Java_bin =/usr/local/jdk1.5.0 _ 05/bin
Path = $ path: $ java_home/bin
Classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
Export java_home java_bin path classpath
Method 2: applicable to all users (not tested)# Gedit/etc/profile. d/Java. Sh
The file content is as follows:Export java_home =/usr/local/jdk1.5.0 _ 05
Export java_bin =/usr/local/jdk1.5.0 _ 05/bin
Export Path = $ path: $ java_home/bin
Export classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
4. Optimized Chinese display
Add simsun. TTF to the font
Create a folder fonts in/usr/local/jdk1.5.0 _ 05/lib, and then create a folder fallback under it.
Create a folder fallback in/usr/local/jdk1.5.0 _ 05/JRE/lib/fonts /.
Copy the simsun. TTF font to these two directories, or copy simsun. TTC to simsun. TTF and put it in these two directories.
5. Configure the browser plug-in
This section describes how to install the Java browser support plug-in.
For example, if I use the Firefox browser, I will create a plugins directory for libjavaplugin_oji.so to link to the corresponding directory of Firefox. The same applies to other browsers;[Root @ localhost plugins] # cd/usr/lib/firefox-1.0.6/plugins/
# Ln-S/usr/local/jdk1.5.0 _ 05/JRE/plugin/i386/ns7/libjavaplugin_oji.so.
6. Java console call[Someuser @ localhost ~] #/Usr/local/jdk1.5.0 _ 05/JRE/bin/controlpanel
Postscript
Most of the content in this article is from JRE installation and configuration to suit the Java program running environment (Author: North, South, North and South), which is completed based on the Forum discussion results, the test passed on Fedora Core 4.