Java Web Environment Development under Linux (CentOS)

Source: Internet
Author: User

First, install the JDK

Baidu search JDK, into the http://www.oracle.com/technetwork/java/javase/downloads/index.html to find their own version of the JDK Linux compression package;

  

Copy out the compressed package ( Click Download First, and then copy the resource link from the download interface )

Create a directory where the JDK resides in the appropriate location on the server

  

wget+ copy of the JDK download link, download the JDK to the directory you created

  

File Rename with mv+ original filename + new file name

  

TAR-XZVF + filename for file decompression

  

To configure the JDK environment variable, open/etc/profile (vi/etc/profile) and add the following on the last side (Tell the System JDK directory):

Export java_home=/home/java/jdk1.8.0_144

Export jre_home=/home/java/jdk1.8.0_144/jre

Exportclasspath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib

Export path= $PATH: $JAVA _home/bin

Source/etc/profile update for configuration to take effect

Java-version and Javac-version test JDK

  

Two versions were found to be inconsistent due to a previous 1.7.0_121 on the system, the workaround is as follows:

  

Note that there is no problem with the configuration, except that the system does not use a new JDK when calling Java commands

  

It is found that the system comes with the/usr/bin/java.

mv/usr/bin/java/usr/bin/java-1.8.0_144, rename the file

Ln-s $JAVA _home/bin/java/usr/bin/java to take your profile chain

  

Both Java and JAVAC versions are consistent with the JDK configuration complete.

Ii. Configuring Tomcat

Baidu search Tomcat, into the http://tomcat.apache.org/download-80.cgi to find their own version of the Tomcat Linux compression package;

  

Copy out the compressed package ( Click Download First, and then copy the resource link from the download interface )

Create a directory where the JDK resides in the appropriate location on the server

wget+ copy of the tomcat download link, download tomcat to the directory you created

TAR-XZVF + filename for file decompression

Enter./startup.sh to start Tomcat

  

After startup still can't access the homepage, consider the problem of firewall, I use centos6.6

Open firewall:chkconfig iptables on (restart in effect);Service iptables start (effective immediately)

  View the ports that are open:/etc/init. D/iptables status

  

Can be found only open port 22nd, need to open 8080 Port use command:iptables -A INPUT -p TCP --dport 8080 - J ACCEPT

< Span class= "PLN" > /etc /rc./init./iptables Save Save Settings

<  Span class= "pun" > /etc< Span class= "pun" >/init./iptables restart restart firewall

  

At this point, you can see that port 8080 is open

Curl localhost:8080 See if you can open the home page

  

Get to Main page configuration complete

  

Java Web Environment Development under Linux (CentOS)

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.