Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2004-08-04
20
1,735 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
String format issue 13 91
java cigar challenge 58 214
grep code 4 199
spring example non maven 4 92
The business world is becoming increasingly integrated with tech. It’s not just for a select few anymore — but what about if you have a small business? It may be easier than you think to integrate technology into your small business, and it’s likely…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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