Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
262 views
in Technique[技术] by (71.8m points)

java - Tomcat is not running even though JAVA_HOME path is correct

When I am trying to run tomcat using startup.bat I get the following error,

The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE

But then I try C:>echo %java_home% and I get the following result

C:Program FilesJavajdk1.6.0_25in

I have even tried setting JAVA_HOME manually to system variable list, but this issue remains.

What can I do to solve it?

I am using Windows 7.


Update

After setting a new system variable named JAVA_HOME and setting its path to "C:Program FilesJavajdk1.6.0_25in", I tried the start up script again and this time I get a new error.

D:Workapache-tomcat-6.0.35in>startup.bat
FilesJavajdk1.6.0_25"" was unexpected at this time.

Any idea what this error means?

I even tried setting the path to "C:Program FilesJavajdk1.6.0_25"(that is without bin) but same error occurs.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try installing java somewhere else - in a directory without spaces. Set again the JAVA_HOME variable and try again. I remember Tomcat had some problems on Window XP with spaces if any variables it was using while starting contained spaces. Maybe it's similar with Windows 7.

I remember I had to change some lines in Tomcat java classes which were handling Tomcat startup.

@Edit: Luciano beat me to noticing it but you should also remove bin from JAVA_HOME

@Edit: I also remember that another fix (didn't test it myself, though) was to set JAVA_HOME to the shorthand version e.g. C:Progra~1Javajdk1.6.0_25


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...