Problems with installing JDK eclipse CDT in Linux Ubuntu

Source: Internet
Author: User

the C/C ++ IDE in Ubuntu is not satisfied, codeblocks is small, but it is not used to it. So I want to install eclipse and try it out. To use eclipse, you must first install JRE or JDK. In the past, if you wanted to write a Java Program under Ubuntu, you chose to install JDK. As a result, JDK installation is not very problematic, but some problems occur during environment variable configuration. Set the environment variables according to the tutorial on the Internet: modified the/etc/profile and/etc/environment files, added environment variables such as java_home jre_home classpath path, and then export. Restarting Ubuntu surprised me: after entering the user name and password, you cannot enter gnome. The prompt is: The session lasts for less than 10 seconds. If you have not logged out, it indicates that the installation has encountered a problem. Or .......

Solution: On the Ubuntu login interface, clickCTRL + ALT + F1 enter the console, and then use the VI editor to modify the modified profile file and environment file.. Then logout, CTRL + ALT + F7, and return to the logon page. The logon is successful. If you do not use the VI Editor, seeHttp://www.cnblogs.com/younes/archive/2009/12/09/1620581.html. This time, I realized the usefulness of learning the VI editor from the bottom of my heart. When you cannot access gnome, only VI can be used. Otherwise, you will use an airplane to edit text files? O (distinct _ distinct) O ~

After the problem is resolved to Gnome, although the profile and environment files are both restored to the previous state (there is no configuration for Java environment variables ), however, entering Java and javac in the console is normal. So far, I am also surprised. Maybe I have a superficial understanding of Linux, or I don't understand it at all.

 

Eclipse installation. I installed eclipse in Ubuntu mainly to write C/C ++ programs, so I directly installed eclipse for C/C ++. The installation process involves adding eclipse to the gnome Start Menu and desktop. The record is as follows:

1. install and configure eclipse

1.1 download the eclipse development platform from eclise.org
A file like the following: eclipse-java-europa-fall2-linux-gtk.tar.gz.

1.2 decompress the file
sudo mkdir/usr/local/dev
sudo mkdir/usr/src/dev
sudo CP eclipse-java-europa-fall2-linux-gtk.tar.gz/usr/src/dev/
Cd/ usr/src/dev
tar zxvf eclipse-java-europa-fall2-linux-gtk.tar.gz-C/usr/local/dev

1.3 create an eclipse Executable File
Sudo touch/usr/bin/eclipse // change the file eclipse access time. If the file does not exist, create a new one.
Sudo chmod 755/usr/bin/eclipse
Sudoedit/usr/bin/eclipse
The content is as follows:
#! /Bin/sh
Export eclipse_home = "/usr/local/dev/Eclipse"
$ Eclipse_home/eclipse $ *
Now enable terminal and execute "Eclipse" to open eclipse.

1.4 add eclipse to the gnome menu
Sudoedit/usr/share/applications/eclipse. Desktop
The content is as follows:
[Desktop entry]
Encoding = UTF-8
Name = eclipse
Comment = Eclipse IDE
Exec = eclipse
Icon =/usr/local/dev/Eclipse/icon. XPM
Terminal = false
Type = Application
Categories = gnome; application; development;
Startupnotify = true

After eclipse CDT is installed, it is found that it is not as good as imagined.CodeThe completion function is unavailable. Another problem is that the system prompts binary not found when setting up empty C ++ project to run. Setting up a hello World C ++ project can run properly.

In fact, when you encounter a problem, it is also an opportunity to learn knowledge by solving the problem. The problem also involves the following knowledge:

 

Three methods for setting environment variables in Linux:

1. Linux variable types

Linux variables are divided by the life cycle of variables. There are two types of Linux variables:

1. Permanent: the configuration file needs to be modified, and the variable takes effect permanently.

2. Temporary: Use the Export command to declare the variable. The variable becomes invalid when the shell is closed.

 

2. Three Methods for setting Variables

1. Add the variable in the/etc/profile file [effective for all users (permanent )]

Use VI to add a variable to the/etc/profile file. This variable will be valid for all users in Linux and will be "permanent ".

For example, edit the/etc/profile file and add the classpath variable.

# Vi/etc/profile

Export classpath =./java_home/LIB; $ java_home/JRE/lib

Note: to change the file to take effect immediately, run # source/etc/profile. Otherwise, it will only take effect the next time you re-enter the user.

 

2. Add the variable [effective for a single user (permanent)] To the. bash_profile file in the user directory )]

Use VI to add a variable to the. bash_profile file in the user directory. The change volume is valid only for the current user and is "permanent ".

For example, edit the. bash_profile under the guok user directory (/home/guok ).

$ VI/home/guok/. Bash. Profile

Add the following content:

Export classpath =./java_home/LIB; $ java_home/JRE/lib

Note: to change the file to take effect immediately, run $ source/home/guok/. bash_profile. Otherwise, it will only take effect the next time you re-enter the user.

 

3. Run the Export command directly to define the variable [only valid for the current shell (BASH) (Temporary )]

Use the [Export variable name = variable value] to define a variable under the shell command line. This variable is valid only in the current shell (BASH) or its subshell (BASH, when shell is closed, the variable becomes invalid. This variable is not available when a new shell is opened. You need to define the variable again if necessary.

 

Reference: http://eagle516.javaeye.com/blog/355074 http://www.javaeye.com/topic/158133 http://hi.baidu.com/hkdao/blog/item/8f15831aeb9464bd4bedbc63.html

 

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.