If the java command is used, I get the help data If the java -version is used, I get the version info If the jar command is used, I get unknown command. Why is that?
I'm running XP, and I get the same thing. If I include the entire path for jar, then I get the help info. Odd.
Perhaps a Microsoft "feature" for discouraging Java developers? (Not that they'd do such a thing, mind you!)
Give a man a fish, he'll eat for one day. <br />Teach a man to fish, he'll drink all your beer.<br /> <br />Cheers,<br /> <br />Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
You could do this for every DOS terminal you open by setting them in the System Properties->Advanced Options->Environment Variables.
Hope this helps.
Regards Luis F
Jeff Bosch
Ranch Hand
Joined: Jul 30, 2003
Posts: 804
posted
0
Hi, Luis -
Actually, I already have my path set. I confirmed that by running the "java" and "javac" commands, which are in the same directory as the "jar" command. If the path were not set, the first two commands would not run.
Usually I run all my command line stuff from batch files anyway so that I have copies of my commands handy, so this is the first time I've seen this issue.
That's truly bizarre. I'm on XP as well, and when I run java or jar from a random folder, they both work. I have the PATH set just as you do. I'm using 1.4.2_05 though, if that makes a difference.
I don't know who you're addressing, but in case I'm the intended recipient: I have both the SDK installed and the JRE. If I only had the JRE, I could not use the javac command.
No MS Java because I would get different version information with the java -version command.
Paths are properly set and working fine except for this one utility.
I agree that it looks and acts like a path problem, but everything else in that directory works. I'm not going to spend any more time on it because I do all my jar/compile/run processing through batch files which use the full pathname because I have to test under multiple or specific compilers or runtime engines.
Thanks for the help though.
David Harkness
Ranch Hand
Joined: Aug 07, 2003
Posts: 1646
posted
0
Originally posted by Stefan Wagner: David: In which way should it make a difference to use j2sdk1.4.2_05 or j2sdk1.4.2_04?
I'm not saying that it should make a difference -- just that it might. I've never experienced that problem, though I don't ever jar from the command line, only through Ant.
David: In which way could it make a difference to use j2sdk1.4.2_05 or j2sdk1.4.2_04?
David Harkness
Ranch Hand
Joined: Aug 07, 2003
Posts: 1646
posted
0
Originally posted by Stefan Wagner: David: In which way could it make a difference to use j2sdk1.4.2_05 or j2sdk1.4.2_04?
There could have been an error when packaging 1.4.2_04: maybe they put the "jar" executable in the wrong directory (so it isn't in the path) or misnamed. Unlikely, but that would do it.
I mentioned it so that if someone for whom "jar" doesn't work has the same JDK version, they know to look at their environment before suspecting the JDK.
JRE installations can sometimes override the MS java and javaw in your Windows directory with their own versions. If that happens (some 1.4 versions do it, some don't I think) you'll end up being able to run java but not javac and jar without setting the path and getting the version you expect.