It's not a secret anymore!
The moose likes Tomcat and the fly likes how to set path? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "how to set path?" Watch "how to set path?" New topic

how to set path?

Dhivya rajagopal
Ranch Hand

Joined: Dec 15, 2010
Posts: 42

hi if i give startup.bat in command prompt, it displays the following

Neither the JAVA_HOME nor the JRE_HOME environment variables is defined
At least one of these variable is needed to run this program.

can you please tell me how to set path?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

That isn't literally the "PATH", which is what is searched to find executable programs.

However, Tomcat does need to know the directory path of a Tomcat JDK, and it gets that information from one of the 2 environment variables you named.

You can set JAVA_HOME like this:

Note that quotes are REQUIRED because of the space in the name "Program files". Also, your actual installed JDK location and version will probably NOT be this exact location - this is only a sample.

You can also set JAVA_HOME system-wide using the Windows Control Panel/System applet. There is an "Environment" button that brings up a dialog. It has 2 parts. One is for setting environment name/value items for the current user, the other one sets for all users. Either one can be used. It won't update currently-open command windows, but new command windows will reflect the changes. Use the command: "echo %JAVA_HOME%" to see.

An IDE is no substitute for an Intelligent Developer.
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1599
Are you on windows?

You can do it via

MyComputer->rightclick->properties->Advanced->Environment Variables

Add new User Variable
Variable name = JAVA_HOME
Variable value = your_java_home_directory;your_java_home_directory/bin;

similarly add entries for tomcat.

To check if it is working, close all command prompts, open new command prompt and type "java -version" and enter. It should list configured java version.

Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
I agree. Here's the link:
subject: how to set path?
jQuery in Action, 3rd edition