aspose file tools*
The moose likes Tomcat and the fly likes  JAVA_HOME should point to a JDK not a JRE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark " JAVA_HOME should point to a JDK not a JRE" Watch " JAVA_HOME should point to a JDK not a JRE" New topic
Author

JAVA_HOME should point to a JDK not a JRE

nattynids Gupta
Greenhorn

Joined: Jan 23, 2012
Posts: 6
Hi,

I am not able to start my tomcat.
It is giving the below gien 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

I have done th following settings in the user variables:

JAVA_HOME: C:\Program Files\Java\jdk1.6.0_24
CLASSPATH: E:\softwares\Tomcatnew\Tomcat\apache-tomcat-6.0.32\lib
PATH: C:\Program Files\Java\jdk1.6.0_24\lib;%JAVA_HOME%\bin

I have done th following settings in the system variables:

JAVA_HOME: C:\Program Files\Java\jdk1.6.0_24
CLASSPATH: E:\softwares\Tomcatnew\Tomcat\apache-tomcat-6.0.32\lib
PATH: %JAVA_HOME%\bin


Please let me know what settings am i missing here.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19762
    
  20

Are those actually user environment variables? Because unless Tomcat runs under your user account it doesn't see those. Change the JAVA_HOME variable into a system variable. You can also drop the other two as far as Tomcat is concerned, it doesn't need those. Especially the PATH variable is dangerous, as it removes all other PATH entries.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
nattynids Gupta
Greenhorn

Joined: Jan 23, 2012
Posts: 6
Hi Rob,

The same values are there in the system variables as well. Tried deleting the PATH as well.
No progress. Same result.
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Any particular reason you have the \lib under path? Keep only the System variables and try removing the \lib from the Path variable. Let this be @ first path - C:\Program Files\Java\jdk1.6.0_24\bin. Try java -version in the cmd prompt and confirm if your path is right. Open a new cmd prompt after altering these values.
nattynids Gupta
Greenhorn

Joined: Jan 23, 2012
Posts: 6
Hi John,

No particular reason why lib was there.
I modified the PATH to C:\Program Files\Java\jdk1.6.0_24\bin
Still the same error.
Do i need to restart the sytem after these changes?
What i did was i modified the PATH & restarted the Tomcat.
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
I have seen this error recently and resolved by configuring JAVA_HOME as a System Variable. Just after configuring and starting Tomcat again it worked well.
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Try below commands and check if you are getting desired results -
nattynids Gupta
Greenhorn

Joined: Jan 23, 2012
Posts: 6
Hi John,

I got the following:

C:\Users\nigupta6>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_24

C:\Users\nigupta6>echo %PATH%
C:\Program Files\Java\jdk1.6.0_24\bin;C:\Program Files\Java\jdk1.6.0_24\bin
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Yikes - So the JAVA_HOME is pointed to a JDK but still you get the error like JAVA_HOME should point to a JDK and not a JRE?
Is the error still occurring while starting Tomcat?
nattynids Gupta
Greenhorn

Joined: Jan 23, 2012
Posts: 6
yes ji...
Tel me do we need to map from java build path in eclipse?
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1535
nattynids Gupta wrote:yes ji...
Tel me do we need to map from java build path in eclipse?


Are you starting Tomcat from within Eclipse? Try restarting eclipse.


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
nattynids Gupta
Greenhorn

Joined: Jan 23, 2012
Posts: 6
Thanks all...
The issue was the incorrect path in the Catalina file in Tomcat...
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
he he... thanks for sharing that
kaiser rommel
Greenhorn

Joined: Apr 23, 2014
Posts: 1
i'm having same problem as you, could you please help me in solving it.
 
Consider Paul's rocket mass heater.
 
subject: JAVA_HOME should point to a JDK not a JRE