Link to home
Create AccountLog in
Avatar of rmvprasad
rmvprasad

asked on

Classpath Setting

I am trying to set a classpath and let the Apache tomcat server run on my windows XP system. I followed the steps based on google. My jdk is 1.6 which is located in program files/java/jdk1.6. If I say javac, it say that the command could not be recognized. It is working for jdk1.4 which is directly stored in c drive. I am not able to start my tomcat. I have also created a batch file which contains the following content, it doesnt work still

set CLASSPATH=.C:\ProgramFiles\Java\jdk1.6.0_04\lib\tools.jar;C:\ProgramFiles\Java\jdk1.6.0_04\jre\lib\rt.jar;C:\apache-tomcat-6.0.10\lib\servlet-api.jar;C:\apache-tomcat-6.0.10\lib\jsp-api.jar;C:\apache-tomcat-6.0.10\lib\el-api.jar;C:\Servlets+JSP;..;..\..
set JAVA_HOME=C:\jdk1.6.0_04
set AXIS2_HOME=C:\axis2-1.2
set ANT_HOME=C:\apache-ant-1.7.0
set PATH=.C:\ProgramFiles\Java\jdk1.6.0_04\bin;%ANT_HOME%\bin
set CATALINA_HOME=C:\apache-tomcat-6.0.10
Avatar of Bart Cremers
Bart Cremers
Flag of Belgium image

You're missing the whitespace in ProgramFiles every where. To set it you could use double quotes around it or use the 8.3 form: c:\PROGRA~1
Avatar of rmvprasad
rmvprasad

ASKER

I tried program files with space. It doesnt work still. Could you please explain what you mean by "use double quotes or use 8.3 form"
I have modified as below still it doesnt work. I have put the double quotes

set CLASSPATH="C:\Program Files\Java\jdk1.6.0_04\lib\tools.jar;C:\Program Files\Java\jdk1.6.0_04\jre\lib\rt.jar;C:\apache-tomcat-6.0.10\lib\servlet-api.jar;C:\apache-tomcat-6.0.10\lib\jsp-api.jar;C:\apache-tomcat-6.0.10\lib\el-api.jar;C:\Servlets+JSP;..;..\.."
set JAVA_HOME="C:\jdk1.6.0_04"
set AXIS2_HOME=C:\axis2-1.2
set ANT_HOME=C:\apache-ant-1.7.0
set PATH="C:\Program Files\Java\jdk1.6.0_04\bin;%ANT_HOME%\bin"
set CATALINA_HOME="C:\apache-tomcat-6.0.10"
Avatar of CEHJ
What is that - a batch file - but where and how is it being executed?
I created a batch file by name autoexe.bat. It is located in c drive i.e the path is c:\autoexe.bat. I opened the command prompt went to the c:\ and typed autoexe, which executed the batch file. It contents are as below

set CLASSPATH="C:\Program Files\Java\jdk1.6.0_04\lib\tools.jar;C:\Program Files\Java\jdk1.6.0_04\jre\lib\rt.jar;C:\apache-tomcat-6.0.10\lib\servlet-api.jar;C:\apache-tomcat-6.0.10\lib\jsp-api.jar;C:\apache-tomcat-6.0.10\lib\el-api.jar;C:\Servlets+JSP;..;..\.."
set JAVA_HOME="C:\jdk1.6.0_04"
set AXIS2_HOME=C:\axis2-1.2
set ANT_HOME=C:\apache-ant-1.7.0
set PATH="C:\Program Files\Java\jdk1.6.0_04\bin;%ANT_HOME%\bin"
set CATALINA_HOME="C:\apache-tomcat-6.0.10"
OK. Execute it and then do

echo %CLASSPATH%

What do you get?
This is what I got

"C:\Program Files\Java\jdk1.6.0_04\lib\tools.jar;C:\Program Files\Java\jdk1.6.0_
04\jre\lib\rt.jar;C:\apache-tomcat-6.0.10\lib\servlet-api.jar;C:\apache-tomcat-6
.0.10\lib\jsp-api.jar;C:\apache-tomcat-6.0.10\lib\el-api.jar;C:\Servlets+JSP;..;
..\.."
OK, so how now are you trying to start Tomcat?
(You would have to do it with a batch file in the same command window). And it (catalina.bat?) should not overwrite any of those variables
To start tomcat I go to
C:\apache-tomcat-6.0.10\bin --> and click on startup.bat. Tomcat is far beyond. Just typing javac in command prompt is giving the message

C:\>javac
'javac' is not recognized as an internal or external command,
operable program or batch file.

I am running all these commands in the same command window
OK - let's step back a bit and organize that file. Can you tell me why JAVA_HOME doesn't correspond to where rt.jar is?
JAVA_HOME path was the path I have come across when I was reading the document in setting up of tomcat. Let me try that and tell you
I tried by setting JAVA_HOME as set JAVA_HOME="C:\Program Files\Java\jdk1.6.0_04\jre\lib\rt.jar"

as I typed javac after running autoexe I git the following

C:\>javac
'javac' is not recognized as an internal or external command,
operable program or batch file.
JAVA_HOME need to be the root directory of where Java is installed. Please post startup.bat as a file attachment
Earlier JAVA_HOME was  JAVA_HOME="C:\jdk1.6.0_04", I have changed it to experiment to rt.jar. I am attaching startup.bat as a text file as batch files are not being accepted to be uploaded
startup.txt
>>I have changed it to experiment to rt.jar.

No - that's completely wrong - it must be the directory in which Java is installed
This time instead of running the batch file I have done it on the command propmt. The results were as below

C:\>set JAVA_HOME="C:\Program Files\Java\jdk1.6.0_04"

C:\>echo %JAVA_HOME%
"C:\Program Files\Java\jdk1.6.0_04"

C:\>javac
'javac' is not recognized as an internal or external command,
operable program or batch file.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
:-)