>> Thankyou, that does work. However, as I am executing these commands from
> the
[quoted text clipped - 7 lines]
> which it can execute. And to find those classes, java.exe looks at the
> classpath.
> >> Thankyou, that does work. However, as I am executing these commands from
> > the
[quoted text clipped - 12 lines]
> works by looking in the current directory AND the path variable, so why
> can't java.exe follow the same standard? Ah well, gripe over...
Hi James,
Well, it may seem strange at first, and even annoying, but the fact of the
matter is that there really is a difference. And this difference explains
the behaviour you are experiencing now.
Files and directories are different concepts than classes and packages.
You mentioned yourself that the Win XP command line uses the current
directory and the path variable, well, the classpath variable for java.exe
can be compared to the path variable for the Win XP cli.
But the Win XP cli only works for Win XP, while Java (the language) is
intended to be run on *any* system (that is, any system for which a JVM is
available).
Anyway, there is a simple way to solve all this: just like you can adjust
the path variable, you can adjust the classpath variable. I'm on Win2k at
the moment, but I suspect XP to be about the same - look in settings/control
panel/system, then click the advanced tab, then the environment variables
button, and look for CLASSPATH under system variables.
Click edit, and add ;. to the classpath variable. Then click ok, etc... to
save this setting.
From now on, you'll be able to use java SomeClass without having to use -cp
. in the command line.
Regards,
JC
ps: I hope this post made some sense, I feel like falling asleep any minute
now :)
--
http://jcsnippets.atspace.com
a collection of source code, tips and tricks