Configure the JSP development environment in RHEL6 -- JDK-Tomcat-eclipse-myeclipse

Source: Internet
Author: User
RHEL6 configuration Environment Survey: 1. shell & gt; java-versionjavaversion & quot; 1.6.0 _ 17 & quot; OpenJDKRuntimeEnvironment (IcedTea61.7.4) (rhel-1.21.b17.el6-i386) OpenJDKServerVM (build14.0-F8,

RHEL6 configuration environment survey:

1. shell> java-version

Java version "1.6.0 _ 17"

OpenJDK Runtime Environment (IcedTea6 1.7.4) (rhel-1.21.b17.el6-i386)

OpenJDK Server VM (build 14.0-f8, mixed mode)

// By default, only jre and jdk are supported. This does not affect the development of eclipse and Tomcat.

Q: Does Tomcat depend on JDK or JRE?

A: JDK: Java Developmetn Kit, JRE: Java Runtime Environment; JDK includes JRE;

Tomcat running depends on JRE;

If it is compiled and used directly, only JRE is enough-java

If you need to compile the source file, you must use JDK -- javac.

Tomcat only depends on JRE. as a JAVA product, the runtime environment of JAVA is sufficient. The JAVA classes of tamcat have been compiled and encapsulated.

In eclipse, you only need to install JRE. even if JDK is specified, the corresponding JRE is added, the reason why eclipse can compile JAVA code with only JRE is that eclispe uses its own compilation program,

To sum up, my jre linux environment has initially met the conditions for configuring Tomcat.

2. I have installed eclipse java development tools on my computer. In this step, I will PASS.

3. Tomcat installation process

First I downloaded a Tomcat: apache-tomcat-5.5.34.tar.gz on the Internet

File Directory>/usr/local/apache-tomcat-5.5.34.tar.gz

Shell> cd usr/local

Shell> tar xzvf apache-tomcat-5.5.34.tar.gz // Extract

Set the CATALINA_HOME environment variable to point to the tomcat installation directory.

> Export CATALINA_HOME =/usr/local/tomcat5.5

// If you are curious about this, I hope you will know that Catalina is the name of the Servlet container, while Jasper is the name of the JSP container. These two containers are combined into Tomcat.

> Cd bin

> Pwd

/Usr/local/tomcat5.5/bin

Note: The bin directory also contains shutdown. sh and shutdown services. And catalina. sh.

>./Startup. sh // start the tomcat service.

Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

At least one of these environment variable is needed to run this program

// The system prompts me that the java_home or jre_home environment variable is not configured. to run this program, at least one of the two environment variables must be merged. Because I only have JRE in LINUX, I will stay with the JRE_HOME environment variable.

> Export JRE_HOME =/usr/java/jre1.6.0 _ 22

> Export PATH = $ JRE_HOME/bin: $ PATH

> ECHO $ PATH

/Usr/java/jre1.6.0 _ 22/bin:/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/sbin: /usr/local/bin:/usr/bin:/root/bin

>./Startup. sh

Using CATALINA_BASE:/usr/local/tomcat5.5

Using CATALINA_HOME:/usr/local/tomcat5.5

Using CATALINA_TMPDIR:/usr/local/tomcat5.5/temp

Using JRE_HOME:/usr/java/jre1.6.0 _ 22

Using CLASSPATH:/usr/local/tomcat5.5/bin/bootstrap. jar

Now, open the browser and enter http: // localhost: 8080/. The Apache Tomcat homepage is displayed. Your JSP server has been basically configured. continue with your development task ~ Good luck ^ ~

***********************************

Q &

***********************************

Q: The above configuration is only available currently. you need to reconfigure it when you enable PC next time. how can you configure JAVA_HOME, JRE_HOME, and tomcat catalina once and for all?

A: 1. set the JDK environment variable -- JAVA_HOME. I only have JRE here, so I set it to the JRE environment variable -- JRE_HOME,

Add the following content to/etc/profile (you can use vi to edit the profile ):

JAVA_HOME =/usr/java/jdk1.6.0 _ 01

CLASSPATH = $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib

PATH = $ PATH: $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin

Export path classpath JAVA_HOME

> Vi/etc/profile

Add

JRE_HOME =/usr/java/jre1.6.0 _ 22

PATH = $ JRE_HOME/bin: $ PATH

Export PATH JRE_HOME

Check whether the settings are correct.

> Pwd

/Usr/local/tomcat5.5/bin

>./Shutdown. sh

Using CATALINA_BASE:/usr/local/tomcat5.5

Using CATALINA_HOME:/usr/local/tomcat5.5

Using CATALINA_TMPDIR:/usr/local/tomcat5.5/temp

Using JRE_HOME:/usr/java/jre1.6.0 _ 22

Using CLASSPATH:/usr/local/tomcat5.5/bin/bootstrap. jar

[Root @ mazego bin] #./startup. sh

Using CATALINA_BASE:/usr/local/tomcat5.5

Using CATALINA_HOME:/usr/local/tomcat5.5

Using CATALINA_TMPDIR:/usr/local/tomcat5.5/temp

Using JRE_HOME:/usr/java/jre1.6.0 _ 22

Using CLASSPATH:/usr/local/tomcat5.5/bin/bootstrap. jar

Everything is normal and there is no exception prompt. it's great, so happy ~ Haha

Note: Before./startup. sh, you may need to enter the command> export CATALINA_HOME =/usr/local/tomcat5.5

-- In this step, I have not tested it yet. it is too troublesome to restart.

If you want tomcat to be started on your own every time you boot the system, add the following command to the/etc/re. d/rc. local startup script or another script.

Export JAVA_HOME =/usr/java/jdk1.6.0 _ 01

Export CATALINA_HOME =/usr/local/tomcat5.5

$ CATALINA_HOME/bin/startup. sh

// I think the export JAVA_HOME =/usr/java/jdk1.6.0 _ 01 seems to be usable, because the environment variables in/etc/profile seem to have had similar configurations, if you are interested in the same shoes, try it yourself ~
Author "MazeGo"

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.