Construction of Java Development environment under CentOS environment

Source: Internet
Author: User

-------------------------------------------------------

Installing the JDK

1. Querying the system default JDK

The CentOS system installs the JDK by default, and it is generally recommended to install the JDK version you need after uninstalling.

Query whether the system has the JDK installed with the following query command:

#rpm-qa |grep java#rpm-qa |grep jdk#rpm-qa |grep gcj (gcj: The GNU Compiler for JAVA,GNU Environment Java compiler, we want Sun's)

To query the current Java version:

From the above,

The OpenJDK 1.7.0_45 is already installed in the system.

2. Remove the installed OpenJDK

To remove the installed OPENJDK, you can use the following command:

Rpm–e JDK related (normal delete command, delete a specific package, if you encounter dependencies, you cannot delete )

Rpm-e –nodeps JDK related ( Force Delete command, ignore dependency, delete specific package. If you use the above command to delete, prompt for other dependent files, then use this command can be strongly deleted)

Note: The JDK here refers to the file of the JDK that was found in the previous step using the query command.

To force the Delete command with RPM, the following:

RPM-E [Option1] [Option2] RPM package

E:erase Erase

Nodeps:no dependences

#rpm-E--nodeps java-1.7. 0-openjdk-1.7. 0.45-2.4. 3.3  -E--nodeps tzdata-java-2013g-1. El6.noarch

The JDK has not been found in the relevant JDK file, indicating that it has been deleted successfully.

Next, to ensure that the JDK has been completely removed, you also need to execute the query command #find/-name JDK Related:

If the query out there are also participating in the directory, you can use the # RM-RF directory, the remaining directory one by one deleted.

The removal of the JDK has been completed.

3. Download and install the JDK

1) Download JDK

Create a folder in the root directory software, specifically put packages

2) Installing the JDK

With the JDK's installation package, you can then install it.

A. Create a new Java directory in the/usr directory and place the installation package in the/usr/java directory:

You can see that the current user has execute permissions, so you do not have to modify file permissions.

Unzip the installation using the TAR command:

After the installation is complete.

You can then delete the compressed package

3) Configure Environment variables

After installation, you need to configure the JDK environment variables.

The global setting method here is to modify Etc/profile, which is a common environment variable for all users.

and then save

Source/etc/profile

Make profile effective

The actual operation of the situation I encountered is only a reboot to really take effect ...

4. Test the JDK

After installing and configuring the environment variables, the next step is to test that the JDK is installed properly.

Enter Java-version or Javac-version, if the version information is displayed, the installation is successful:

As you can see, the JDK has been installed successfully. Next, let's test a simple Hello World program.

A. Create a new Hello.java file

B. Add the following code:

Save exit.

C. Compile, run:

As can be seen from the above, the JDK compiles and runs normally.

At this point, the installation of the JDK has ended successfully.

--------------------------------------------------------

Installing Tomcat

1. Download Tomcat

Official address: http://tomcat.apache.org/

2. Download OK, proceed to the storage directory via CD command and unzip:

3. Move to the installed directory

We can move through the MV command.

4. Assigning permission to run

5. Running

If there is no error, enter localhost:8080 in the browser, back to the page appears, then congratulations.

Enter the following command to close Tomcat

--------------------------------------------------------------------------------------------------------------- -------

Install Eclipse

1. Please download the Eclipse Linux version yourself

2. Unzip the installation under/software

3. We have all the software installed to/usr, so the MV command is executed

4. Use the symbol to connect the directory

注意
Symbolic link Usage ln-s source file destination file,-S is symbolic meaning (symbolic) soft Connect
Symbolic links work by creating a special type of file that will only generate a mirror image of a file in the location you selected. Its function is to create a synchronized link for a file in another location. When we need to use the same file in different directories, we don't need to put a file in every required directory, we just put the file in a fixed directory, and then The other directory uses the ln command to link it so that it does not have to use disk space repeatedly. Similar to the shortcut keys under Windows, so you can open the software without knocking at the terminal.
If you use LS to look at a directory, found that there is a file at the end of a @ symbol, that is a file generated with the LN command, with the ls-l command to check, you can see the path of the link shown

The command means that a synchronization connection is created in the/usr/bin/eclipse directory, and the source file is in the/usr/eclipse/eclipse directory

5. Create a desktop launcher

VI opens with a new file

Add the following code

Above is the application that displays eclipse in CentOS, and describes it, such as encoding, naming, displaying icons, versions, types

6. Check if eclipse is added to the application

Run Eclipse

It feels good, haha

Construction of Java Development environment under CentOS environment

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.