Thanx for the responses to my particular problem, BUT I really would still
like to know just what exactly it was that "threw out" my classpath settings
every now and then in System Properties!!! And wouldn't it get pretty
laborious if I had to type in "java -classpath etc. etc." every single time
that I want to activate, say, Tomcat or Resin or Ant? I wanted to avoid all
of that by maintaining my System Classpath for all of the environment
variables!
You're like me. I don't want someone to fix the problem; I want someone to
explain the problem so I can fix it myself. It is like the proverb: Give a
man a fish and he is fed for a day, teach a man to fish and he is fed for
life.
You talk about going into "System Properties". The terminology you are
using is not quite what I'm used to hearing. If you indicated that you go
to the Control Panel and open System to change the Environment Variables I
could have more confidence that you are doing the right thing.
So just to be safe I'll point out that opening an MSDOS Prompt and
entering:
set CLASSPATH=...
where ... is the classpath you want set, will only affect the current
MSDOS Prompt. The moment you close that shell your settings are lost. I
suspect you know this and are not doing this. I'm just being pedantic.
The proper way to set the classpath on Windows XP is to go to the Control
Panel, run System. This will give you a window with some tabs on it. I
think the Advanced tab has the link to the environment variables. Go to
the Environment variables and you will see two sets of variables; User and
System. The User variables are for you and only you. The System variables
will affect anyone who logs in. If you have a classpath in both areas it
will combine them.
The information you enter for the classpath will get saved in the Windows
registry. Why would this information be getting wiped? Usually it is due
to installation. Most installations affect the registry. I have found a
few products that set the variables rather than append to them. This means
a software installation will work but it will mess up everything else on
your system.
I doubt you are constantly installing things that mess up the classpath
path but it is a possibility.
Another option is you are running something that reads and writes to the
registry. This wouldn't be an MSDOS batch file or anything like that. This
would be writing directly to the registry.
Another option would be that your system is on a network and the
adminstrator is running some remote registry tools that backup/restore the
registry. For example, you can set your system to automatically log you
in. You have to put your password (plain text) into the registry. When the
computer starts up it automatically logs you in. This is a huge security
hazard. Our admin removes this sort of stuff when detected. Maybe your
admin is running software that doesn't like classpath being changed. I
know it is a security risk to put . in any paths. Are you adding . to your
CLASSPATH?
Along a similar line, are you running software like Zone Alarm or
CyberGuard? I am sure there are software packages that will restore your
registry if it thinks someone changed it without your permission.
Final thought, you have a virus. Something is running on your system that
maliciously erases your classpath.
Bottom line, see if there is any software controlling or affecting the
registry that might be your problem. There is a program from SysInternals
called RegMon that monitors the registry. You could install and run it.
Set the filters to watch for changes in:
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
I believe this is where CLASSPATH is stored. Then you can see what program
is affecting your CLASSPATH.