Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAVA_HOME should point to a JDK not a JRE

 
nattynids Gupta
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
nattynids Gupta
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try below commands and check if you are getting desired results -
 
nattynids Gupta
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes ji...
Tel me do we need to map from java build path in eclipse?
 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
nattynids Gupta
Greenhorn
Posts: 6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all...
The issue was the incorrect path in the Catalina file in Tomcat...
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
he he... thanks for sharing that
 
kaiser rommel
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm having same problem as you, could you please help me in solving it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic