Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 18 of 18

Thread: Jar command problems

  1. #1
    Member
    Join Date
    Feb 2013
    Posts
    57
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Question Jar command problems

    Hi,

    When I try to run the simple 'jar' command on the Windows terminal I get the following error:

    'jar' is not recognized as an internal or external command, operable program or batch file.

    I have the latest JDK version installed, any ideas?

    Thanks


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Jar command problems

    not recognized as an internal or external command
    That looks like a message from the OS saying it can not find the jar command. Windows uses the contents of the PATH environment variable to find commands. If the folder with the jar command is not in the PATH variable, the OS can't find it.
    Either add the path to the jar command to the PATH
    or use the full path to the jar command when you try to execute it.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Member
    Join Date
    Feb 2013
    Posts
    57
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Jar command problems

    Ok I see. I'm not sure where the jar command is located in Windows, it comes with the JDK package, right?

    I'm using a tutorial to create a jar file with a bundle of java classes, but I came across this jar command problem, so therefore I have no idea about this jar command in the first place

    Thanks

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Jar command problems

    Find where the JDK is installed and use the OS's search function to find the jar command.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Member
    Join Date
    Feb 2013
    Posts
    57
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Jar command problems

    Yea I came across a Java folder in Program Files, and in the Java folder there is another folder called jre6. I did a search on jar, which resulted files that ended with the .jar extension. But there was no jar.exe command file? What is the standard representation of the jar command (name and extension type of file)?

    Thanks

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Jar command problems

    It should be in the JDK folders, not the jre
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Member
    Join Date
    Feb 2013
    Posts
    57
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Jar command problems

    I cant seem to find the any JDK folders? I only have the jdk6***-64.exe file which I installed before, but no folders?

    Thanks

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Jar command problems

    If you don't have a JDK installed, you won't have the jar command.
    If you don't understand my answer, don't ignore it, ask a question.

  9. #9
    Member
    Join Date
    Feb 2013
    Posts
    57
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Jar command problems

    Thanks for your time. Although I do have the JDK installed as I've been writing java programs with this computer.

    Thanks

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Jar command problems

    If you have the JDK installed, the jar command file is in the same folder as the javac command
    If you don't understand my answer, don't ignore it, ask a question.

  11. #11
    Member
    Join Date
    Feb 2013
    Posts
    57
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Jar command problems

    I can't even find the javac command anywhere on my computer. Is there a link to download the jar command? I've searched, but no positive sites.

    Thanks

  12. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Jar command problems

    I've been writing java programs with this computer.
    Do you compile them on that computer? What command does the compilation?
    If you don't understand my answer, don't ignore it, ask a question.

  13. #13
    Member
    Join Date
    Feb 2013
    Posts
    57
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Jar command problems

    Yes i compile them on this computer. I use Jgrasp to compile them?

    Thanks

  14. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Jar command problems

    Does it use the javac command to do a compile?
    If you don't understand my answer, don't ignore it, ask a question.

  15. #15
    Member
    Join Date
    Feb 2013
    Posts
    57
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Jar command problems

    I don't think so. I just click the 'Run' button on the Jgrasp IDE and it then returns the result on the JGrasp console. I don't use the command terminal for compilation.

    Thanks

  16. #16
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Jar command problems

    Read the API doc and FAQ for the IDE to see how it works.
    If you don't understand my answer, don't ignore it, ask a question.

  17. #17
    Junior Member
    Join Date
    Mar 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Jar command problems

    the problem is likely that you have set the path of jdk in the environment variable. i believe you are using window 7. if this is so, follow this simple steps if you have successfully installed your jdk
    firstly, you need to know where your jdk is located on your system. you can find this by tracing it doing
    go to your local disk, then to program files, then to java, then to jdk, then to bin.
    you copy the path to be like this, c:\program files\java\jdk1.7.0_09\bin
    note: the version of the jdk may vary.
    secondly, go system properties, then to advanced system settings, then to environment variable, then under system variable locate path and click on "edit" just tab the front arrow key to make sure you didnt clear the highlighted directory
    now, append a semicolon followed by the copied path in step one.
    then click ok.

    --- Update ---

    the problem is likely that you have not set the path of jdk in the environment variable. i believe you are using window 7. if this is so, follow this simple steps if you have successfully installed your jdk.
    firstly, you need to know where your jdk is located on your system. you can find this by tracing it as follows
    go to your local disk, then to program files, then to java, then to jdk, then to bin.
    you copy the path to be like this, c:\program files\java\jdk1.7.0_09\bin
    note: the version of the jdk may vary.
    secondly, go system properties, then to advanced system settings, then to environment variable, then under system variable locate path and click on "edit" just tab the front arrow key to make sure you didn't clear the highlighted directory
    now, append a semicolon followed by the copied path in step one.
    then click ok.

  18. #18
    Member
    Join Date
    Feb 2013
    Posts
    57
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Jar command problems

    Thanks for your reply.

    Yes that worked, thanks alot. See computer has two 'Program Files' folders (Program Files and Program Files (x86)) for some odd reason, and I was looking in the (x86) folder, but was located in the original folder. Thanks again for your help

Similar Threads

  1. run jar file inside a jar file?
    By ufrubnuckle in forum Java Theory & Questions
    Replies: 1
    Last Post: February 21st, 2013, 06:58 AM
  2. employing library jar from windows command line
    By meathead in forum Other Programming Languages
    Replies: 6
    Last Post: December 12th, 2011, 04:49 PM
  3. [SOLVED] jar file Built(clean and build) perfectly, but not running as jar
    By chronoz13 in forum What's Wrong With My Code?
    Replies: 18
    Last Post: July 11th, 2011, 11:41 AM
  4. Program.jar -command
    By luigi10011 in forum Java Theory & Questions
    Replies: 1
    Last Post: April 23rd, 2011, 09:49 AM
  5. Java.jar and Mysql.jar
    By kurt-hardy in forum Java Theory & Questions
    Replies: 1
    Last Post: January 27th, 2011, 09:48 AM