Error reported after Tomcat is started-the file "-djava. endorsed. dirs =" cannot be found in Windows"

Source: Internet
Author: User

Error reported after Tomcat is started --- the file cannot be found in Windows "-djava. endorsed. dirs ="
The result is that the environment variable catalina_home is not set.
Introduction to Tomcat
1. Download necessary software
① JDK 1.5.0.3
② Tomcat 5.5.9
2. Configure the environment
Windows users:
My computer ------> right-click -------> properties -------> details -------> environment variable
Add the system variable java_home X:/jdk1.5.0 _ 03 (no bin or extra points)
Add.; % java_home %/lib/tools. jar; % java_home %/lib/dt. jar in class_path;
Add % java_home %/bin in Path
Add the system variable catalina_base X:/tomcat5.5.
Add the system variable catalina_home X:/tomcat5.5.
Add the system variable tomcat_home X:/tomcat5.5.
Add % catalina_home %/common/lib/servlet-api.jar in class_path
Note: Here X is the installed drive.
The setting depends on the startup. BAT file in the bin directory.
You can open startup. bat in the editing status to check whether the file needs to read the system variable. We can set the variable. For example, the content of the startup. BAT file of tomcat in my current version is as follows:
@ Echo off
If "% OS %" = "windows_nt" setlocal
Rem ---------------------------------------------------------------------------
Rem start script for the Catalina Server
Rem
Rem $ ID: startup. bat, V 1.6 18:25:11 yoavs exp $
Rem ---------------------------------------------------------------------------

Rem guess catalina_home if not defined
Set current_dir = % Cd %
If not "% catalina_home %" = "" Goto gothome
Set catalina_home = % current_dir %
If exist "% catalina_home %/bin/Catalina. Bat" Goto okhome
CD ..
Set catalina_home = % Cd %
Cd % current_dir %
: Gothome
If exist "% catalina_home %/bin/Catalina. Bat" Goto okhome
Echo the catalina_home environment variable is not defined correctly
Echo this environment variable is needed to run this program
Goto end
: Okhome

Set executable = % catalina_home %/bin/Catalina. bat

Rem check that target executable exists
If exist "% executable %" Goto okexec
Echo cannot find % executable %
Echo this file is needed to run this program
Goto end
: Okexec

Rem get remaining unshifted command line arguments and save them in
Set pai_line_args =
: Setargs
If "% 1" "=" Goto donesetargs
Set cmd_line_args = % cmd_line_args % 1
Shift
Goto setargs
: Donesetargs

Call "% executable %" start % cmd_line_args %

: End
We can clearly see that this file needs to read the value of the system variable catalina_home, so we can set catalina_home in the environment variable to the tomcat installation path.
3. Start and close Tomcat
There are two ways to start and close installed Tomcat:
① Directly click the startup. BAT and shutdown. BAT files in the running bin directory.
② Because we have set the path above, we can directly type startup or shutdown in the DOS window.
4. Set a virtual directory
Edit the Server File (X:/tomcat/CONF/server. XML)
Because the information of the Server File needs to be read during Tomcat startup, you must restart tomcat after changing the Server File.
For example:
We plan to create a virtual directory of myjsp. You only need to add the following code before/host> in the server. xml file:
<Context Path = "/myjsp" docbase = "C:/myjsp" DEBUG = "0" reloadable = "true" crosscontext = "true">
</Context>
Here, path is the virtual directory to be created, and docbase is the location of the actual directory on the hard disk.
5. Try the results of our previous work
Compile a simple example to test whether our virtual directory is available.
Refresh. jsp (C:/myjsp/refresh. jsp)
<% @ Page Language = "Java" %>
<% @ Page import = "Java. util. Date" %>
<HTML>
<Head>
<Title> auto refresh </title>
<% Response. setheader ("refresh", "5"); %>
</Head>
<Body bgcolor = # cc99dd> <br>
<Center> <Center> refresh time: 5 seconds </center> <br>
<Center> now time is: <% = new date () %> </center>
</Body>
</Html>
Type HTTP; // localhost: 8080/myjsp/refresh. jsp in the address bar.

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.