Java Notes---Cenos Configuring the Java Development Environment (OPENJDK+TOMCAT8)

Source: Internet
Author: User

First, preface

Linux has been used for a period of time, but after each study work, no record of their own experience. And then every time after a long period of work again, you have to revisit the various materials. Therefore, now learn good, will their own learning are recorded, the existence of local, written blog, into the cloud, to wait for the future temperature.

Second, installation OpenJDK

Java has 2 jdk, one is Oracle's JDK, and the other is OpenJDK. I chose OpenJDK as the Java development environment. I use SECURITYCRT to operate the CenOS6.5 on the cloud server for installation configuration.

View Available Packages

CentOS 6.X and 5.X comes with OpenJDK runtime Environment (OpenJDK), we use Yum to view the list of OPEN-JDK packages available under Cenos, execute commands:yum search java | Grep-i–color JDK

Installation

After looking at all the available installation packages, we choose what we need to install. I choose to be Java8. Execute command:yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel

Once you see complete and know that the installation is completed, now test the installation success. Execute command:java-version

Note : You can also use Javac as a test command

View Results

Once installed, let's look at the JDK on the machine. After using the Yum command on Linux, OPENSDK is installed into the /usr/lib/jvm/ directory:


Note : D indicates that this is a folder and L indicates a link

Set Java-home

Just use Yum directly after installation, not yet, you have to continue to configure, set Java-home. We need to set Java_home to a directory containing the Java executable program.

①CD into the only directory under the JVM

② edit /etc/profile: Let all users on the system use Java (OPENJDK). We add the following code at the end of the file:

# 推荐写链接到那个唯一目录的链接的名字。如下所示:export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk.x86_64export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport PATH=$PATH:$JAVA_HOME/bin

③ make the configuration file effective: Execute command source/etc/profile

④ test: Test Java again for installation configuration success:

    • Execute command:java-version

    • Execute command:javac

    • Program Test: Write a Helloworld.java test

Based on the results, we know that Java is now installed on the machine, and it can be run correctly!

Third, install Tomcat

Preparing resources

We need to prepare the TOMCAT8 package first. I first download the Tomcat8 locally, and then use FileZilla to upload to the remote server.

Extract

Use the TAR command to unzip the TOMCAT's compressed package. Execute command:tar-zxvf apache-tomcat-8.0.0.rc3.tar.gz

Move

Once the decompression is complete, we need to move the extracted directory to the /usr/local directory. Execute command:MV apache-tomcat-8.0.0/usr/local

Renaming

For the convenience of memory and later use, we renamed the folder using the MV command to TOMCAT8. Execute command:MV apache-tomcat-8.0.0 tomcat8

Configure Java-home

Edit the /usr/local/tomcat/bin/catalina.sh file and configure the Java-home variable so that Tomcat can search the JDK directory and work with it.

Start the service

Now, let's start Tomcat to try. Use the CD command to switch to the /usr/local/tomcat8/bin/ directory, and then execute the command:./startup.sh

Open ports

After starting the good service, we also need to open 8080 ports. Note: The HTTP protocol uses 80 ports by default, and Tomcat uses 8080 ports by default.

Test

Once the above configuration is complete, check the operation of Tomcat. Execute command:ps-ef | grep tomcat

Next, open the browser and test. Local Machine test Enter http://localhost:8080 on the address bar; If remote machine, enter http://remote server ip:8080 to view the results.

Java Notes---Cenos Configuring the Java Development Environment (OPENJDK+TOMCAT8)

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.