"Linux" Jdk+eclipse build C/D + + development environment

Source: Internet
Author: User

Note: The reference examples provided in this article are installed in the CentOS Linux environment and are not guaranteed to be applicable to other versions of the Linux system.

    • · Pre-installation precautions

Compiling the source code requires the corresponding code-compiling tool, the eclipse installed in this article is just a shell to write code, not to compile the code, so your Linux system should have a compiler, so that eclipse when compiling the source code can be called to the corresponding compiler The small, installed GCC, which is my eclipse, uses G++/GCC to compile the code. If you do not have GCC installed, see:

Installation and compilation of the "Linux" Linux-C + + code example

    • · Download the required files

1, download the JDKyou need, you can download the RPM installation package or the GZ compressed package,

Specific to the Oracle website to download: JDK Oracle official website

2. Download the Linux version of Eclipse IDE for C + +, which you downloaded is a compressed package:

Eclipse Oracle Website

The installation of Eclipse is generally similar to Windows, first set up the JDK, configure the environment variables the eclipse is ready for use.

    • · The first step is to install the JDK and configure the environment variable path

1. Extract the JDK folder from the downloaded JDK package to the location you want, such as a small codec to extract the

/usr/java/This directory, the location of my JDK is '/usr/java/jdk1.7.0_51 '

2. Configure the system environment variables:

Method One:

Use the root account to log in, small series using the root accounts login can modify any file, find the file '/etc/profile ' right-click to modify the properties, the permissions in permission to Read-write,

Open the profile file and add your JDK location information to the export location:

Export java_home=/usr/java/jdk1.7.0_51

Export Java_bin=/usr/java/jdk1.7.0_51/bin

Export path= $PATH: $JAVA _home/bin

Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

Export Java_home java_bin PATH CLASSPATH

You just need to change the first two lines, then close and save the profile, reboot to make path effective, and in terminal input java-version can view Java version information,

Method Two:

To modify the '/etc/profile ' file using the command at the terminal:

① Open terminal, use the SU command to enter a password to get root administrative rights

② Use the command to open the profile in the terminal:

# Vi/etc/profile

③ Press ENTER to enter the file changes, the code shown here is exactly the same as in method one, scroll the cursor to the modified position (see method one), press the I button on the keyboard to start the insert operation (the lower left corner of the terminal is displayed), the configuration of the environment variable is entered in this position, press the ESC key, Then press ":" button, enter exit, you can exit the Save:

As with method one, it is best to restart it, and then use the command java–version to view the Java version information.

    • · Step Two install Eclipse IDE for C + +

Because the JDK environment variables are all good, this step is very simple, open the Eclipse package you downloaded, just unzip to the location you want, there is an eclipse file under the Eclipse folder, this is the boot file, double-click to start Eclipse.

To create a desktop shortcut:

Right-click on the desktop to create a Launcher, the command is specified as the path of the boot icon.

    • · C + + Hello Word test

"Linux" Jdk+eclipse build C/D + + development environment

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.