[snip]
>> Also you haven't included the current directory, it should be
>>
[quoted text clipped - 9 lines]
>>
>> it should give you a blank line (I think).
[snip]
>> Compiling doesn't use CLASSPATH
[snip]
> thank you very much.. it turns out if I run it like this..
>
> java -cp . hello
>
> it runs fine.. what does this mean? that java is finding rt.jar in
> CURRENT DIR? this doesn't make sense...
No it means it is finding your class (hello) in the current dir i.e.
where it is. It knows where rt.jar is, you don't need to worry about that.
> also to humor everyone who says I should set classpath, I set the
> classpath thus:
>
> C:\j2sdk1.4.2_11\jre\lib\rt.jar;.;c:\tomcat\common\lib\servlet-api.jar
> (and restarted machine, although don't know if this is necessary..)
How did you set this?
> but it won't run either if I do 'java hello',
What does echo %CLASSPATH% show you?
> only if i do
>
> java -cp . hello
>
> can somebody pls explain this..
I don't think CLASSPATH is set like you think it is, and I don't think
it works like you think it does.
> (yes, I also get feeling it can't find MY class (not rt.jar..)
> but WHY.. class does get put in same dir where src code is that I'm
> compiling..
But compiling doesn't use the classpath, I don't see why this matters.
> have been doing all this for over a year now, why is JVM
> acting so wacky all of a sudden?
Because you changed something. Did this occur just after you installed
Tomcat?
> my tomcat won't start either now..
How are you starting it? What is the error? You shouldn't have to set
CLASSPATH to get Tomcat to run.
> this is freaking me out... have no idea what's going on here...)
>
> many thanks... Frances
James
Frances - 24 Mar 2006 03:31 GMT
> [snip]
>
[quoted text clipped - 27 lines]
> No it means it is finding your class (hello) in the current dir i.e.
> where it is. It knows where rt.jar is, you don't need to worry about
that.
so the classpath is for the class I'm running and not for rt.jar? I
didn't know that..
>> also to humor everyone who says I should set classpath, I set the
>> classpath thus:
[quoted text clipped - 3 lines]
>>
> How did you set this?
in Control Panel, where you set env vars (where you set path, JAVA_HOME
for Tomcat, etc..)
>> but it won't run either if I do 'java hello',
>
> What does echo %CLASSPATH% show you?
C:\j2sdk1.4.2_11\jre\lib\rt.jar;.;c:\tomcat\common\lib\servlet-api.jar
now that I set it..
>> only if i do
>>
[quoted text clipped - 10 lines]
>
> But compiling doesn't use the classpath,
oh? I didn't know this..
I don't see why this matters.
>> have been doing all this for over a year now, why is JVM acting so
>> wacky all of a sudden?
>
> Because you changed something. Did this occur just after you installed
> Tomcat?
I installed Tomcat a long time ago.. have not changed anything..
>> my tomcat won't start either now..
>
> How are you starting it? What is the error? You shouldn't have to set
> CLASSPATH to get Tomcat to run.
no error, the shell appears very briefly then disappears...
>> this is freaking me out... have no idea what's going on here...)
>>
>> many thanks... Frances
>
> James
am at home now, where am on j2sdk1.4.2_09; don't even have a classpath
set, not even for tomcat, but can compile and run classes ok, regardless
of what dir they're in, like I always have been able to, and at work
this always worked fine too, until today.. again thank you very much..
Roedy Green - 24 Mar 2006 06:57 GMT
> >> this is freaking me out... have no idea what's going on here...)
> >>
> >> many thanks... Frances
Read the background material to explain the classpath. See
http://mindprod.com/jgloss/classpath.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
>thank you very much.. it turns out if I run it like this..
>
> java -cp . hello
>
>it runs fine.. what does this mean? that java is finding rt.jar in
>CURRENT DIR? this doesn't make sense...
java can find its own files by independent means. Back in Java 1.0 you
had to help it with the classpath, but that has not been true a long
time.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Frances - 24 Mar 2006 15:06 GMT
>>thank you very much.. it turns out if I run it like this..
>>
[quoted text clipped - 6 lines]
> had to help it with the classpath, but that has not been true a long
> time.
got rid of classpath altogether; now it's working again... have no idea
what caused the problem.. this is bizarre... so: b/c yesterday all of a
sudden it stopped working set classpath (which I had never done before)
it still wouldn't work.. this morning came in, got rid of classpath
altogether, and now all of a sudden it works again... really weird..
problem am having now is my Tomcat won't start (don't even get errors,
when run startup.bat Tomcat shell appears very briefly and disappears...
so have no idea how I will deal with this one.. am begining to believe
this all must have been some fluke thing in my machine..) thank you
very much..
James Westby - 24 Mar 2006 15:09 GMT
>>> thank you very much.. it turns out if I run it like this..
>>>
[quoted text clipped - 17 lines]
> this all must have been some fluke thing in my machine..) thank you
> very much..
Look in the logs. That will tell you what the error is.
James
Roedy Green - 24 Mar 2006 19:04 GMT
>. am begining to believe
>this all must have been some fluke thing in my machine..)
Before you go founding a new religion based on these miracles, please
read the essay I gave you http://mindprod.com/jgloss/classpath.html
This sort of craziness is normal and, believe it or not, has a
rational explanation. Nearly every Java programmer before you went
through this same bafflement.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
> C:\j2sdk1.4.2_11\jre\lib\rt.jar;.;c:\tomcat\common\lib\servlet-api.jar
> (and restarted machine, although don't know if this is necessary..)
If you are using windows type
set and check all the environment variables. You may not be
permanently setting them. See
http://mindprod.com/jgloss/environment.html
you don't need rt.jar on the classpath and you likely don't need that
tomcat jar either. Read the Tomcat install instructions what to do.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
> thank you very much.. it turns out if I run it like this..
>
[quoted text clipped - 14 lines]
>
> can somebody pls explain this..
The classpath separator is a : not a ;. It's not a Windows path.

Signature
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555