Install and configure Java programming using Eclipse in Ubuntu Linux

Source: Internet
Author: User
Install JDK
1. Download jdk1.5 Linux installation version jdk-1_5_0_15-linux-i586.bin. Click to download
2. Create the installation directory: sudo mkdir/usr/Java
3. Switch to this directory: sudo CD/usr/Java
4. Copy the installation file to this directory: sudo CP $ download/jdk-1_5_0_15-linux-i586.bin.
5. Because it is an executable file, we can install it directly. If not, you can change the pattern to an executable file: sudo chmod + x jdk-1_5_0_15-linux-i586.bin
6. The license will be displayed later. Press enter to the end and enter yes to start installation.
7. If everything is normal, the installation will be completed in a few minutes. Generate a new directory for a jdk-1_5_0_15 under the current directory
8. To make it run Java commands in other directories, you need to configure environment variables, which is similar
9. if you want to use all users on the machine, it is best to add the following content to the/etc/profile file. Otherwise, you can add them ~ /. Profile:
Export java_home =/usr/Java/jdk1.5.0 _ 15
Export classpath = $ classpath: $ java_home/lib: $ java_home/JRE/lib
Export Path = $ java_home/bin: $ java_home/JRE/bin: $ path: $ homr/bin
10. Enter Java-version in terminal to check whether the correct version is displayed.

Install Eclipse
1. Download eclipse3.3 and select Java developers. Click to download.
2. decompress the package to a directory, such as/home/test.
3. Right-click the desktop and create an Eclipse shortcut pointing to the/home/test/eclipse executable file.

Eclipse GBK environment Configuration
1. because under Ubuntu, the default encoding method is UTF-8, which is also the international standard, but in Windows Simplified Chinese version of the default GBK encoding, so when you switch from Windows platform to Ubuntu, the exception caused by garbled code occurs in the original Eclipse project. Therefore, we need to set the current Eclipse environment to GBK encoding.
2. Choose Window-> preferences-> general-> workspace-> text file encoding, which defaults to the UTF-8, you can enter GBK in Other directly, click Apply
3. You will find that Chinese garbled characters in the source code can be properly displayed. If there are garbled characters in some projects, you can add another setting: choose Window> preferences> general> Content Types> text> Java source Files> Default encoding, fill in the GBK and click the Update button.
4. If you are writing a GUI program, you will find that Chinese characters in the GUI are garbled. You can solve this problem by referring to the settings below.


Set Chinese font
1. Download The 文 font. Click to download
2. Switch to the JRE font Directory: sudo cd $ JAVA_HOME/jre/lib/fonts
3. Create the fallback directory sudo mkdir fallback and switch to the directory sudo cd fallback.
4. Copy the Chinese font to this directory: sudo cp $ DOWNLOAD/hwzs. ttf.
5. Generate the fonts. dir file: sudo mkfcontdir
6. Generate the fonts. scale file: sudo mkfontscale
7. Run the TestFrame program again. Chinese garbled characters have been resolved.
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: 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.