Installation configuration management of installation and configuration of Java J2SE Development Kit (JDK)

Finishing : lazy cat [stephencat AT 126.com], finishing on October 14, 2005.
From : LinuxSir.Org
Abstract : Many users want to use Sun Java JDK / JRE instead of using the default system comes and GCJ Java Virtual Machine to run, debug Java applications. This article will solve this problem.

Applicable releases : use GCJ as the default Java environment release, such as Fedora Core 4

The main content index

  • Java placement
  • Create a shortcut to replace GCJ
  • Configuration environment variable
  • Optimization of Chinese display
  • Configure the browser plug-in
  • Call JAVA Console

First, download the JDK

1. Download

From here you can find the latest JDK:

http://java.sun.com/

 

According to their machines to download the corresponding version, for example,

jdk-1_5_0_05-linux-i586.bin

 

This is the J2SE Development Kit 1.5 update 5 for Linux self-extracting execution of sh script. Which already contains the installation cabinet.

2, the release of the package

See all the files in the current directory

[root@localhost sunjava]# ls

jre-1_5_0_04-linux-i586.bin

 

SFX script execution sh

[root@localhost sunjava]# sh jre-1_5_0_04-linux-i586.bin

Do you agree to the above license terms? [yes or no] yes

 

See all the files in the current directory again

[root@localhost sunjava]# ls

jre1.5.0_04 jre-1_5_0_04-linux-i586.bin

 

In fact sh script named jdk1.5.0_05 release from the folder to the current directory

Second, the configuration of the Java compiler, runtime environment

1. Set up Java

Jdk1.5.0_05 move the folder (or copy) to the / usr / local directory

[root@localhost sunjava]# mv jdk1.5.0_05 /usr/local/

 

2. Create a shortcut to replace GCJ

Production of java and javac shortcuts (statically linked), instead of 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

 

Ln the role of the -f parameter is forced to cover the already existing / usr / local / java statically linked files. Since the bin file in the directory jdk folder content can replace the contents of /jdk1.5.0_05/jre/bin, and thus can be used directly /jdk1.5.0_05/bin this path.

Note : This step is not the GCJ completely removed from your computer. You can still use whereis gcj command to find it and use it when needed.

3. Set Environment Variables

Method a : Personalized separate end user configuration

Edit the current user's .bashrc, namely:

$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 Two : apply to all users (not tested)

#gedit /etc/profile.d/java.sh

 

Document reads 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. Optimize the Chinese show

Plus a font simsun.ttf

Established in /usr/local/jdk1.5.0_05/lib folder fonts, and then create a folder under which the fallback
create a folder fallback in /usr/local/jdk1.5.0_05/jre/lib/fonts/

Then copy the font simsun.ttf to these two directories, or copy simsun.ttc to simsun.ttf also, and then put these two directories

5. Configure the browser plugins

Here are the installation of the Java browser plug-in support.

For example, I use firefox browser, compared libjavaplugin_oji.so build a link to the corresponding directory firefox plugins directory, the other browsers the same way;

[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 .

 

Call 6. JAVA Console

[someuser@localhost ~]# /usr/local/jdk1.5.0_05/jre/bin/ControlPanel

 

postscript

Most of this article from: "the JRE installed and configured to suit JAVA program run with the environment" (Author: North-South-North), combined forum to discuss the results of the completion of finishing in the Fedora Core 4 test.

Reproduced in: https: //www.cnblogs.com/licheng/archive/2008/01/21/1047396.html

Guess you like

Origin blog.csdn.net/weixin_34112208/article/details/92630581