Install JDK + Tomcat on Linux

Source: Internet
Author: User

1. Download JDK
1. log on to the Sun JDK official download URL: http://java.sun.com/javase/downloads/index.jsp

2. Download The jdk1.6.0 _ 35-linux-i586-rpm.bin file.

Ii. Install JDK
1. added the executable permission for the jdk1.6.0 _ 35-linux-i586-rpm.bin file.
# Root> chmod 755 jdk-1_5_0_07-linux-i586-rpm.bin
2. Run jdk1.6.0 _ 35-linux-i586-rpm.bin.
# Root>./jdk1.6.0 _ 35-linux-i586-rpm.bin
Automatically decompress and install

Ii. Install JDK
1. added the executable permission for the jdk1.6.0 _ 35-linux-i586-rpm.bin file.
# Root> chmod 755 jdk-1_5_0_07-linux-i586-rpm.bin
2. Run jdk1.6.0 _ 35-linux-i586-rpm.bin.
# Root>./jdk1.6.0 _ 35-linux-i586-rpm.bin
Automatically decompress and install

(3) log on again
[Note]
<1> use environment variables in Linux: separate paths, different from those in windows;
<2> in Linux, use ($ + environment variable name) to reference the original variable value. In Windows, use % + environment variable name + %. For example, $ path and % PATH %.
<3> no space exists in classpath. For example, c: \ Documents and Settings \ Seagar \ jdk1.5 in windows will be invalid path names.

<4> the current directory "." In classpath cannot be ignored.
<5> export exports environment variables as global variables
<6> case sensitivity
2. Modify the. bashrc file (valid for individual users)
(1) # root> VI/home/Seagar/. bashrc
(2) Use the VI editor to add the following statements to the. bashrc file:
Java_home =/usr/Java/jdk1.6.0 _ 35
Path = $ java_home/bin: $ path
Classpath =. $ java_home/lib/dt. jar: java_home/lib/tools. Jar
Export java_home, path, classpat
3. Modify it directly in Shell (the current shell is valid)

Export java_home =/usr/Java/jdk1.6.0 _ 35 Path = $ java_home/bin: $ path

Export classpath =. $ java_home/lib/dt. jar: java_home/lib/tools. Jar

Iv. test installation
1. view the Java-version
2. Use the VI editor to compile a Java program
(1) # root> VI hello. Java
(2) Programming
Public class hello
{
Public static void main (string [] ARGs)
{
System. Out. println ("hello ");
}
}
3. Compile: javac hello. Java
4. Execute: Java hello
5. Download Tomcat
: Http://tomcat.apache.org/download-70.cgi. we recommend that you download the gzcompressed package.
Decompress tomcat to the specified directory, and run startup. Sh (./startup. Sh) in the bin directory to start Tomcat.
Okay. You can access http: // ip: 8080/, but note the following:
The Linux Firewall does not trust port 8080, so the local machine cannot access tomcat in the virtual machine. You can simply disable the firewall first,
The command to close is as follows:
Takes effect immediately and becomes invalid after restart: chkconfig iptables off
After the restart, the Service takes effect permanently: Service iptables stop
You can also add 8080 to the trusted port.
Here, we also need to note that when downloading the software, you can directly download the wget URL from the Linux system using the wget command. However, the URL must be valid after authorization.

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.