• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1756
  • Last Modified:

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

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
Valeri
Asked:
Valeri
  • 8
  • 5
  • 2
  • +5
1 Solution
 
rrzCommented:
>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
 
ValeriAuthor Commented:
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
 
UmeshMySQL Principle Technical Support EngineerCommented:


Check out this kink..

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

Hope this Helps!!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
rrzCommented:
>I have assigned JAVA_HOME to : C:\j2sdk1.4.2_03,  
Please show us the line in your Autoexec.bat
0
 
ValeriAuthor Commented:
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
 
expertmbCommented:
>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
 
expertmbCommented:
>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
 
ValeriAuthor Commented:
I don't have ";" at the end of the line.
0
 
bloodredsunCommented:
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
 
ValeriAuthor Commented:
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
 
rrzCommented:
>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
 
ValeriAuthor Commented:
Windows 2000
0
 
ValeriAuthor Commented:
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
 
rrzCommented:
> How do you start the Tomcat???    
I just double click on  Tomcat\bin\startup.bat    
0
 
ValeriAuthor Commented:
This causes "catalina start", it is similar like "catalina run" as I can see. And it's open CMD window, isn't it?
0
 
rrzCommented:
>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
 
ss_pCommented:
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
 
ValeriAuthor Commented:
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
 
phuphaCommented:
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
 
quddhusCommented:
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

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 8
  • 5
  • 2
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now