Configure the Java compiling and running environment for Linux JDK

Source: Internet
Author: User

1. Download the Linux JDK

1. download the latest Linux JDK: unzip j2se Development Kit 1.5 Update 5 for Linux. The package has been installed.

2. Release the software package to view all the files in the current directory [root @ localhost sunjava] # The lsjre-1_5_0_04-linux-i586.bin executes the sh self-extracting script

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

2. Do you agree to the above license terms? [Yes or No] Yes

View All files in the current directory again

1. [root @ localhost sunjava] # ls

2. 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 to move the jdk1.5.0 _ 05 folder (or copy it) to the/usr/local directory [root @ localhost sunjava] # mv jdk1.5.0 _ 05/usr/local/

2. Create shortcuts to replace gcj's Java and javac shortcuts (static links), instead of gcj.

1. # cd/usr/bin

2. # ln-S-F/usr/local/jdk1.5.0 _ 05/JRE/bin/Java

3. # 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 folder in the Linux JDK directory can replace/jdk1.5.0 _ 05/JRE/bin, you can also 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: edit the current user's. bashrc for personalized configuration of independent end users, that is, $ gedit ~ /. Bashrc or # gedit/home/xxxx/. bashrc Add the following five elements:

1. java_home =/usr/local/jdk1.5.0 _ 05

2. java_bin =/usr/local/jdk1.5.0 _ 05/bin

3. Path = $ path: $ java_home/bin

4. classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar

5. Export java_home java_bin path classpath

Method 2: applicable to all users (untested) # The contents of the gedit/etc/profile. d/Java. Sh file are as follows:

1. Export java_home =/usr/local/jdk1.5.0 _ 05

2. Export java_bin =/usr/local/jdk1.5.0 _ 05/bin

3. Export Path = $ path: $ java_home/bin

4. Export classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar

4. optimizes the Chinese display and adds a simsun font. TTF creates a folder fonts in/usr/local/jdk1.5.0 _ 05/lib, create a folder fallback under it and create a folder fallback in/usr/local/jdk1.5.0 _ 05/JRE/lib/fonts/and copy the font simsun. TTF to these two directories, or put simsun. copy the TTC file to simsun. TTF also works, and then put it in these two directories.

5. Configure the browser plug-in. Here we will introduce 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;

1. [root @ localhost plugins] # cd/usr/lib/firefox-1.0.6/plugins/

2. # ln-S/usr/local/jdk1.5.0 _ 05/JRE/plugin/i386/ns7/libjavaplugin_oji.so.

6. Call the Java console [someuser @ localhost ~] #/Usr/local/jdk1.5.0 _ 05/JRE/bin/controlpanel most of the content in this article comes from: JRE installation and configuration to suit the environment in which Java programs run. the results of the forum discussion were sorted out and tested on Fedora Core 4.

Recommended for beginners a programming technology learning site, 96 stack Software Programming Network, http://www.96dz.com, which has c ++ video tutorial, C # video tutorial, Java video tutorial download, c \ c ++, Java, and C #. net and other programming technology abstracts, including the current mainstream Linux programming and web programming learning materials video tutorial download.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.