File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes please help with tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "please help with tomcat" Watch "please help with tomcat" New topic

please help with tomcat

xue shen

Joined: Jul 05, 2002
Posts: 23
I downloaded tomcat-4.0.4 and unzip the file to c:\jakarta-tomcat-4.0.4.
set up the following system enviromental variables:
.;c:\j2sdk1.4.0-beta\bin; c:\j2sdk1.4.0-beta\jre;c:\j2sdk1.4.0-beta\lib;
when try to start tomcat from command prompt with the startup.bat, I get the following errors:
Windows cannot find-'Djava.endorsed.dirs='. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search.
The JAVA_HOME environment variable is not defined correctly. This environment variable is needed to run this program. The system cannot find the batch label specified - end
Using JAVA_HOME: c:\j2sdk1.4.0-beta3;

Could any body help out on this?
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
If you take a look your %CATALINA_HOME%\bin\setclasspath.bat file, you will see the following lines of code.

If the setclasspath.bat script is not able to verify the existence of the %JAVA_HOME%\bin\java.exe file, then it prints the error message that you quoted.
You stated that JAVA_HOME = c:\j2sdk1.4.0-beta3;
However, your path is set as follows.
.;c:\j2sdk1.4.0-beta\bin; c:\j2sdk1.4.0-beta\jre;c:\j2sdk1.4.0-beta\lib;
It appears to me that you have a conflict. Your JAVA_HOME property is saying that java is installed in a directory named c:\j2sdk1.4.0-beta3 but your path indicates a directory named c:\j2sdk1.4.0-beta. Either you need to remove the final character from you JAVA_HOME property or you need to add it to your PATH.
To make sure that your JAVA_HOME and your PATH are in agreement, it is safer to define your PATH in terms of JAVA_HOME. For example,

You stated that your system prints the following.

If the system prints .. for CATALINA_BASE and CATALINA_HOME, then it means that CATALINA_HOME is not set. You claimed, however, that you set CATALINA_HOME as follows.
Are you sure that your definition is recognized by the command prompt window that you are using? Is it possible that you are using a command prompt window that was opened before you set CATALINA_HOME in the control panel? For example, when you type the "set" command in your command prompt window does it print the CATALINA_HOME property as you expect?
You also asked for help with the java.endorsed.dirs environment variable which happens to be a new feature of Java 1.4 and the Endorsed Standards Override Mechansim. XML parsers and other endorsed standards are included in the J2SE v1.4 release of Java. The java.endorsed.dirs system property is used to override the use of endorsed packages that are included in a Java release such as J2SE v1.4.
The java.endorsed.dirs system property is set in your %CATALINA_HOME%\bin\setclasspath.bat file as shown below.

BASEDIR is set to CATALINA_HOME in the catalina.bat file.
The sequence of events is a follows. You invoke %CATALINA_HOME%\bin\startup. The startup.bat file makes sure that CATALINA_HOME is setup properly and then it calls %CATALINA_HOME%\bin\catalina.bat. The catalina.bat script calls setclasspath.bat. The setclasspath.bat script sets the java.endorsed.dirs environment variable.
I hope that above information helps.

Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="" target="_blank" rel="nofollow">Try my mock exam.</a>
xue shen

Joined: Jul 05, 2002
Posts: 23
Thanks very much for your help. It works now.
jQuery in Action, 3rd edition
subject: please help with tomcat
It's not a secret anymore!