Well I am having quite the same strange problem,
but for apps, and I'm finding weird how Windows XP deals with CLASSPATH. One shouldn't have to type:
-cp .
Despite we (at least I did) declared (CLASSPATH, PATH, JAVA_HOME) in my "Enviroment variables" (look below) when I run the command prompt (cmd.exe) it does not run the classes straight, it says:
"Exception in thread "main" java.lang.NoClassDefFoundError:"
Then I need to run with: java -cp %CLASSPATH% ....
and it runs. Shouldn't the system recover the CLASSPATH automatically?
Strange when I go into command prompt and press "set"
it reports the PATH, CLASSPATH just as declared...
Do you think my enviroment variables are too large for the memory?
Another weird thing is that, in my opinion, should be enough to declare
in the classpath only the folders where the .jar libraries were
and not declaring each .jar file...
the JVM should scan them for the libraries automatically, but it does not happens!!
Look how I have to set my PATH and CLASSPATH for it to find them as example:
CLASSPATH=.;C:\j2sdk140\lib\;C:\j2sdk140\lib\tools.jar;C:\j2sdk140\lib\servlet.jar;C:\j2sdk140\lib\jspengine.jar;C:\Program Files\JavaSoft\JRE\1.3.1\lib\ext\QTJava.zip;C:\j2sdk140\lib\xt.jar;C:\j2sdk140\lib\sax.jar;C:\j2sdk140\lib\dom4j.jar;C:\j2sdk140\lib\xt.jar;C:\j2sdk140\lib\xp.jar;C:\j2sdk140\lib\saxon.jar;
PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\j2sdk140\bin;c:\j2sdk140\lib;c:\jswdk101;c:\jswdk101\lib;C:\PROGRA~1\COMMON~1\AUTODE~1;D:\PROGRA~2\BC5\BIN;
Don't you find it strange? Is it my mistake?
What can I do to avoid to type -cp %CLASSPATH% everytime
when running apps from XP command prompt (cmd.exe)?
Many Thanks
Al.
Al,
Ah, the developers' curse strikes again!
Let me try to explain; You have two seperate Java environments on your system. One is the JRE that handles browser stuff (aka plug-in), the other is your SDK development env. Each env. has no knowledge of the other, so you tried to compensate for that by referencing both locations in your classpath - quite a mess, huh?! Unfortunately, as fate would have it, all of this info was provided to the JRE (I assume) and not the SDK, thus the problem really hasn't been solved (yet).
What to do: Re-direct Windows to NOT use the JRE, but instead use the SDK. Just point windows out of the JavaSoft dir, and instead to your j2sdk dir.
That should pretty much fix everything, and you should be able to completely remove classpath (i.e. don't even set it to anything). The important thing from your path= is that the sdk/bin is set, so I'd leave that alone.
Oh, about your classpath: it had to point to .jar files for the benefit of the JRE when doing XML stuff, this could have been avoided if you put a second copy of these jars in the jre/lib/ext dir. But of course, this won't be necessary if you do as I suggest and re-direct windows out of the jre and into the sdk.
I hope I explained it well enough (more or less :)
-Ron