Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

java - Setting up Tomcat 7 on server: "NB: JAVA_HOME should point to a JDK not JRE"... Why?

I'm trying to set up Tomcat 6 on my server instance (Fresh install of Windows Server 2008 R2 Enterprise). I want to make a Java EE service available via a URL.

It works via localhost on the server. I put the .war file in my /webapps, run startup.bat in the /bin and then i navigated to localhost:80/myWebServce in my browser to get directed to my welcome page.

When I try to create a service by running service.bat (in the /bin folder)) I get an error message that says:

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

My question is: Why? I thought a JDK was just a JRE + Some development tools(an IDE, a debugger etc). Why does tomcat need a JDK To run as a service, but not on localhost? What's in a JDK that's needed to run a webservice?

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

remove semi-colon from the end of JRE_HOME / JAVA_HOME variables. there should not be semi-colon…

variable: JAVA_HOME value : C:Program FilesJavajdk1.6.0 (note : no semicolon at the end)

variable: JRE_HOME value : C:Program FilesJavajre1.6.0 (note : no semicolon at the end)

Apply above changes and run your tomcat successfully.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...