File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes 'jar' is not recognized as an internal or external command Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark " Watch " New topic
Author

'jar' is not recognized as an internal or external command

Priya Lavti
Ranch Hand

Joined: Oct 11, 2004
Posts: 41
Hi
after installing j2sdk1.4.2, when i try to give the command jar -? or javac -? from outside the bin directory of javahome, Error ocurrs as "'jar' is not recognized as an internal or external command, operable program or batch file."
The class path set is CLASSPATH=D:\j2sdk1.4.2\bin;D:\j2sdk1.4.2\lib;D:\j2sdk1.4.2\jre

Strange behavior is that while giving java -? from outside the bin directory, it executes properly and displays the help of java command.

Looking forward for the reply
thanx in advance


-Priya
SCJP 5.0
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
Your path variable controls where the system will search for commands. What is your path set to?


Mike Gershman
SCJP 1.4, SCWCD in process
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
Your PATH variable must include the the path to the bin directory of your SDK. So in your case
Priya Lavti
Ranch Hand

Joined: Oct 11, 2004
Posts: 41
Thanx for the replying.
It works well after setting the path variable.
John McClellan
Ranch Hand

Joined: Aug 15, 2011
Posts: 35
Hello. I saw this thread and wanted to ask real quick how you might be able to find that path if you don't know exactly what version the SDK is. Thanks!
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11250
    
  16

what OS are you using? On windows, i'd just look around using windows explorer.

you can also try "javac -version" to find what version you have, which may give you some clues. or you can use windows 'search' function to, well, search for it.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
John McClellan
Ranch Hand

Joined: Aug 15, 2011
Posts: 35
I used the command you mentioned and found that the version was 1.6.0_22, so I went to the C:\ directory and ran a Windows search for j2sdk1.6.0_22, but it didn't come up with anything. Sometimes the Windows search engine misses things. What else can I do to find it?
John McClellan
Ranch Hand

Joined: Aug 15, 2011
Posts: 35
Apparently the directory that I needed to find was jdk1.7.0\bin for some reason. Thanks for your help!
duc nguyen hoang
Greenhorn

Joined: Aug 16, 2013
Posts: 2
JAVA_HOME is not resolved. Instead of using %JAVA_HOME% in your path system variable, change it to explicit jdk path and restart your command prompt
Paweł Baczyński
Bartender

Joined: Apr 18, 2013
Posts: 915
    
  14

A call from the grave!
PS. Nobody said anything about JAVA_HOME in this thread...


Formely Pawel Pawlowicz
duc nguyen hoang
Greenhorn

Joined: Aug 16, 2013
Posts: 2
Someone may find what i said helpful though...
 
 
subject: 'jar' is not recognized as an internal or external command