Solved

JAVA_HOME in Tomcat...?!?!?!

Posted on 2004-08-04
20
1,722 Views
Last Modified: 2012-05-05
I installed Tomcat on my computer, and I'm trying to run one jsp, but I'm getting this error :

Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK

I have assigned JAVA_HOME to : C:\j2sdk1.4.2_03, I tried with C:\j2sdk1.4.2_03\bin also, but the result is the same!
It's the first time when I use Tomcat, so I thing that the problem is not so big, but I can't get over it, because I'm not so familiar with this stuff.

Thanks in advance!
Best regards,
Valeri
0
Comment
Question by:Valeri
  • 8
  • 5
  • 2
  • +5
20 Comments
 
LVL 27

Expert Comment

by:rrz
ID: 11716230
>I installed Tomcat on my computer  
So, you can browse to Tomcat's home page using  http://localhost:8080/      ?
Can run the servlet and JSP examples on that page  ?
>I have assigned JAVA_HOME to : C:\j2sdk1.4.2_03
That should work, but show us the actual line in your Autoexec.bat  .
0
 
LVL 16

Author Comment

by:Valeri
ID: 11716512
Yes, I'm able to see Tomcat home page, it works perfectly, and examples that come with Tomcat installation also work perfectly, but as I see the .class files are with old date, in my opinion this means that they are not compiled now.
The newly added .jsp's doesn't work?!?! I don't know way?
Thanks in advance,
Valeri
0
 
LVL 26

Expert Comment

by:ushastry
ID: 11717154


Check out this kink..

http://www.coreservlets.com/Apache-Tomcat-Tutorial/

Hope this Helps!!
0
 
LVL 27

Expert Comment

by:rrz
ID: 11722815
>I have assigned JAVA_HOME to : C:\j2sdk1.4.2_03,  
Please show us the line in your Autoexec.bat
0
 
LVL 16

Author Comment

by:Valeri
ID: 11723801
Hi again,
I have assigned JAVA_HOME using "Control Panel / System / Environment Variables". As I know that's way to do that. Am I wrong? My Autoexec.bat is empty.
The standart Tomcat Welcome page works fine, after that I tried very simple .html page and it also works, but when I rename this simple .html page to .jsp page I get this error! Except initializing JAVA_HOME variable, is there anything else that I have to do?
Thanks in advance.
Valeri
0
 
LVL 6

Expert Comment

by:expertmb
ID: 11723971
>I have assigned JAVA_HOME to : C:\j2sdk1.4.2_03

check the variable value for JAVA_HOME
if you have for example "C:\j2sdk1.4.0_03;"
then remove the ";"

mb...


0
 
LVL 6

Expert Comment

by:expertmb
ID: 11723974
>I have assigned JAVA_HOME to : C:\j2sdk1.4.2_03

check the variable value for JAVA_HOME
if you have for example "C:\j2sdk1.4.0_03;"
then remove the ";"

mb...


0
 
LVL 16

Author Comment

by:Valeri
ID: 11724114
I don't have ";" at the end of the line.
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 11724542
Have you created your CLASSPATH variable?
e.g.
JAVA_HOME is C:\j2sdk1.4.2_03
J2EE_HOME is C:\j2sdkee1.4
Classpath is .;%J2EE_HOME%\lib\j2ee.jar;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\jre\lib\charsets.jar
0
 
LVL 16

Author Comment

by:Valeri
ID: 11725373
I found out something very interesting. When I go to "install_dir/bin" and start the Tomcat by "catalina run" the server starts and everything goes ok, but when I start it by "Monitor Tomcat / Start service" the JSP's don't work!
What is wrong and where is the difference?
Best regards,
Valeri
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 27

Expert Comment

by:rrz
ID: 11726083
>My Autoexec.bat is empty.
You could try editing it directly by right clicking on the file itself and choosing "edit".
Mine looks like this  

SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\j2sdk1.4.2_04\BIN
SET JAVA_HOME=C:\j2sdk1.4.2_04
SET CATALINA_HOME=C:\jakarta-tomcat-5.0.25
SET CLASSPATH=.;C:\jakarta-tomcat-5.0.25\common\lib\servlet-api.JAR


>but when I start it by "Monitor Tomcat / Start service" the JSP's don't work!  
I don't know this. What is your OS ?
0
 
LVL 16

Author Comment

by:Valeri
ID: 11733186
Windows 2000
0
 
LVL 16

Author Comment

by:Valeri
ID: 11733324
So, may be the main question is : How do you start the Tomcat??? By going to Tomcat\bin directory and typing "catalina run" or by starting the service by "Strat Menu/Programs/Apache Tomcat 5.0/Monitor Tomcat" and after that 'Start service' ? My be the secong approach is just wrong, I don't know?!?!
So, how do you start Tomcat? Because by typing "catalina run" everithing is ok!

Best regards,
Valeri
0
 
LVL 27

Expert Comment

by:rrz
ID: 11735422
> How do you start the Tomcat???    
I just double click on  Tomcat\bin\startup.bat    
0
 
LVL 16

Author Comment

by:Valeri
ID: 11735768
This causes "catalina start", it is similar like "catalina run" as I can see. And it's open CMD window, isn't it?
0
 
LVL 27

Expert Comment

by:rrz
ID: 11735883
>And it's open CMD window, isn't it?  
I don't know what you asking.
I just followed instructions in the documentation. See  RUNNING.txt  in Tomcat's root folder.
0
 
LVL 3

Accepted Solution

by:
ss_p earned 50 total points
ID: 11735911
Hi
You are correct.
But it is a default procedure to start with Startup.bat in Windows and startup.sh in Unix/linux

double click startup.bat.
Once the server had started up.

Are you still getting the error.

if so can you print out the error which comes up.So that we can help you out

Prasannaa
0
 
LVL 16

Author Comment

by:Valeri
ID: 11750255
Yes,
When I start Tomcat by double click startup.bat then everithing is OK.
I just tried to start it from "Start service" item from the right click on the icon that appears next to the clock, at the right-bottom corner. What this service is designed for?
0
 
LVL 1

Expert Comment

by:phupha
ID: 11755990
Valeri,

Apache tomcat services (jk_nt_services) use JAVA_HOME information that you configured when you install tomcat.

if you set a wrong path, there're only 2 way for you.
- run Tomcat\bin\startup.bat by yourself
- Install tomcat again and don't miss it

0
 
LVL 1

Expert Comment

by:quddhus
ID: 11773795
As one of our friend mentioned

1. we should have the PATH, JAVA_HOME, CATALINA_HOME & CLASSPATH environment variables set properly.
also you can add necessary jar files in the CLASSPATH variable

SET CLASSPATH=.;C:\jakarta-tomcat-5.0.25\common\lib\servlet-api.jar;%CLASSPATH%

2. where is your jsp files are placed?

Eeither you can use the defaule examples application or you can configure your own application by creating a folder under
        %CATALINA_HOME%\webapps, ie.. %CATALINA_HOME%\webapps\myapp
     This 'myapp' folder should have
     1. WEB-INF folder, inside this folder copy/create web.xml , 'lib' folder and 'classes' folder
             -classes folder will have the custom classes and packages
             -lib folder will have the necessary jar files
     2. jsp files can be under the new application folder ie.. %CATALINA_HOME%\webapps\myapp or a new subfoler can be created %CATALINA_HOME%\webapps\myapp\myjsps and
        used.

           
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
What is Backup? Backup software creates one or more copies of the data on your digital devices in case your original data is lost or damaged. Different backup solutions protect different kinds of data and different combinations of devices. For e…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now