Configure the Java compiling and running environment for Linux JDK

Source: Internet
Author: User

It is particularly worth mentioning that there are many things worth learning about Linux JDK. Here we mainly introduce Linux JDK, including the introduction of Linux JDK.

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. jre1.5.0_04 jre-1_5_0_04-linux-i586.bin 

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 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 for creating static links for java and javac shortcuts) to replace 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  

Method 2: applies to all users without tests) # The content of the gedit/etc/profile. d/java. sh file is 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 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/ . 

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.

  1. Install Linux JDK and run Eclipse
  2. Linux disk partitioning tool and command usage
  3. Linux Kernel 2.6.33 official version released
  4. Create, compile, and execute a Linux operating system
  5. Linux Process Management parent process and child process

Related Article

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