CLASSPATH Disappears!

S

Steve R. Burrus

I need help/assistance from someone re. this continuing problem of mine of
the CLASSPATH suddenly disappearing for no obvious reason!!! Believe me, it
is quite a "laborious" task to always have to re-set all of the Environmetal
Variables that my copy of Java and other applications have to rely on. I
tried and tried to figure out what could causing this problem, but could
come up nothing! Can anybody help me please?
 
A

Abrasive Sponge

Steve said:
I need help/assistance from someone re. this continuing problem of mine of
the CLASSPATH suddenly disappearing for no obvious reason!!! Believe me, it
is quite a "laborious" task to always have to re-set all of the Environmetal
Variables that my copy of Java and other applications have to rely on. I
tried and tried to figure out what could causing this problem, but could
come up nothing! Can anybody help me please?

Well, without knowing any details, do you put this in the user profile?
or the system profile? If you put it in the user profile, if you log in
as someone else, it won't find it.

P.S. Classpaths are dangerous to put into environment variables.
 
S

Steve R. Burrus

I am quite sorry that I didn't earlier specify that I am talking about the
classpath env. variable in the System Properties applet in my Win XP Pro
 
W

Wendy S

Steve R. Burrus said:
I am quite sorry that I didn't earlier specify that I am talking about the
classpath env. variable in the System Properties applet in my Win XP Pro

You'll be better off if you set the classpath separately for each program
you want to run.

One way to do this is to make a .bat file that executes java with
the -classpath option. Example:
java -classpath ..\lib\asjava.zip;. TestContactRecord

The only thing I set in System Properties is the "home" directory for
various things such as TOMCAT_HOME. Then JAVA_HOME, and %JAVA_HOME%/bin is
in the PATH.
 
S

Steve R. Burrus

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

Abrasive Sponge

Steve said:
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!

That's why it is extremely common for java developers to create ant
scripts or bat files because we don't like typing all that stuff in either.
 
W

Wendy Smoak

Steve R. Burrus said:
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!!!

You're using Windows, right? Sometimes... stuff just disappears. There's
NO way for us to tell you what happened.
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?

Well, since Tomcat completely ignores the system CLASSPATH, you would be
wasting your time.

I start Tomcat with the provided 'startup.bat' and Ant with 'ant.bat'.
Neither of them needs anything on the system classpath.

If you do find yourself typing the same thing over and over, put it in a
batch file.
I wanted to avoid all of that by maintaining my System Classpath for all
of the environment variables!

I wonder if you're talking about PATH and not CLASSPATH? Yes, I do have
environment variables for JAVA_HOME, TOMCAT_HOME, etc., and refer to
%JAVA_HOME%\bin in my PATH environment variable.
 
S

Steve R. Burrus

Not to "beat a dead horse", but I feel like I DO have some valid/legitimate
uses for the System CLASSPATH, i.e., for Ant I read that the ant.jar should
be on the classpath in setting it up, and I also use the "TextPad" text
editor, and I need Tomcat's "common\lib\servlet-api.jar and jsp-api.jar"
files specified for T.P. to work okay with Tomcat!! And yes Wendy, I am
using Windows XP Professional Edition, and I guess that I have all but given
up on ever getting a good reason why I suddenly lose my classpath settings!
 
W

Wendy Smoak

Not to "beat a dead horse", but I feel like I DO have some valid/legitimate
uses for the System CLASSPATH, i.e., for Ant I read that the ant.jar should
be on the classpath in setting it up,

Reference? The provided ant.bat file does a fine job of setting the
classpath when launching Ant.
and I also use the "TextPad" text
editor, and I need Tomcat's "common\lib\servlet-api.jar and jsp-api.jar"
files specified for T.P. to work okay with Tomcat!!

If TextPad functions as an IDE, there should be a way to set the compile
classpath.
http://cs.senecac.on.ca/~bpj444/pages/TextPad_config.html
Scroll down to "Fix Option 2".

Alternately, change how you start TextPad and set CLASSPATH before launching
the app.
 
J

Joseph Dionne

Steve said:
Not to "beat a dead horse", but I feel like I DO have some valid/legitimate
uses for the System CLASSPATH, i.e., for Ant I read that the ant.jar should
be on the classpath in setting it up, and I also use the "TextPad" text
editor, and I need Tomcat's "common\lib\servlet-api.jar and jsp-api.jar"
files specified for T.P. to work okay with Tomcat!! And yes Wendy, I am
using Windows XP Professional Edition, and I guess that I have all but given
up on ever getting a good reason why I suddenly lose my classpath settings!
[snip]

Please dont top post, you will not get the attention you wish.

Since the OS, in your case Windows XP, is causing the CLASSPATH
environment variable to disappear, you need to open a M$ ticket.
Posting you question here will not help, other than getting work around
solutions for your OS problems. You have gotten some really good
advice, don't discount it.

I have experienced Windows Users with similar complaints. Most times it
was a pure user error. Some users with an open "msdos" window would
update either the User or the System Environment settings and wonder why
the already started MSDOS window does not have it. That is the way
Windows works, start a new MSDOS window, and viola, the new environment
variable is there.

Also, I believe XP has swapped the order of the windows, putting the
User on top of the System, or visa versa (I don't use Windows much).
Some users thought they updated the System but instead updated their
User environment. Everything worked when the tested it, but not with
some schedule task or other automated process started the java app.

I make the assumption you are an expert Windows user (excuse the
oxymoron) and are not making such a bone head error. If you are doing
what you claim, using the System control to add a CLASSPATH environment
variable, and it is disappearing, and reappearing if I read your posts
correctly, then you need to check over your system. I think your
answers will be found on a M$ site or newsgroups.

Joseph
 
S

Steve R. Burrus

Yes indeed, that's the only that way that I myself have ever used TextPad in
the past, as an IDE. >>"If TextPad functions as an IDE, there should be a
way to set the compile classpath"<< I mainly set the classpath to the
"C:\jakarta-tomcat-[version num.]\common\lib\[servlet-api.jar or the
jsp-api.jar]" to get a servlet to compile using TextPad.


<<Snip<<
 
?

.

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

Steve R. Burrus

Thanx very much for the LONG and HELPFUL response to my initial posting!!!
Listen, to answer back to you about a few points which u made. (1:) You
saying to me : >>"....and open System to change the Environment
Variables...."<<. Yes, I certainly meant just the "System" -- I could drop
the "Properties" part of that. (2:) No offense intended, but I already knew
all of this that you said, have been doing this for some years now! > >>"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."<<
(3): And then you said this to me : >>".....that your system is on a
network....."<< No, I am merely a home user,, most of the time, and just
rely on my local drive!!
(4) : And then your "final thought" to me : >>"Final thought, you have a
virus.* Something is running on your system that
maliciously erases your classpath"<< * Should be No again, I periodically
run my Norton SystemWorks system virus scanner, at the frequency of one
time every week, so that shouldn't be why I occassionally am lacking the
CLASSPATH in the System I shouldn't think.
(5) : Final point, I will try to watch for any changes in the registry key
"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" thru the
RegMon program to check for any other program which might be interfering
with my CLASSPATH.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top