Results 1 to 5 of 5
  1. #1
    Mr Wogan is offline Member
    Join Date
    Dec 2012
    Posts
    14
    Rep Power
    0

    Default I can't get jar to work on the CLI

    Hello. I'm trying to use jar to check the contents of a .jar file I have made, but I just can't seem to get it to work. Is the information at Viewing the Contents of a JAR File (The Java™ Tutorials > Deployment > Packaging Programs in JAR Files) outdated or is it something strange with my machine? If I do
    Java Code:
    C;\Users\Terry>jar tf F:\jam.jar
    on the CLI it just spits out
    Java Code:
    'jar' is not recognized as an internal or external command,
    operable program or batchfile
    I've just downloaded and installed the latest version of Java again just to make sure it wasn't a problem with a strange installation and I made certain it was the 64 bit version I was getting

    I've tried many, many variations of the command, ibut they all have obviously failed. I can't say for certain it sn't just because of a typo I keep repeatedly making because I have very poor eyesight,but I get the strong impression it's something to do with my installation. TheOperating System I'm using right now is Windows 7 64 bit.

  2. #2
    Sierra is offline AN21XX
    Join Date
    Mar 2012
    Location
    Munich
    Posts
    297
    Rep Power
    3

    Default Re: I can't get jar to work on the CLI

    Obviously your jar command is not known by the system. As simple as that it cannot find the path to your jar executable in the systems PATH variable.
    Either add it there or go to the folder where the "jar" toll is located and try it there... :)

    I am still fascinated that your system works on the one... "C;\" :)
    I like likes!

  3. #3
    Mr Wogan is offline Member
    Join Date
    Dec 2012
    Posts
    14
    Rep Power
    0

    Default Re: I can't get jar to work on the CLI

    You mean there's something strange about my system? In what way? I usually did this sort of thing on Linux untill my eyesight became poor, so I don't really know what a normal file path on Windows would be like. Maybe that's why yhe jar command isn't recognized? However, I do make a pont of keeping my system as close to a default setup as I possibly cando in order to avoid strange things like this happening. I install as few programs as I can and tend to avoid system customization beyond what I need to--Like making the mouse pointer as large as possible and colour inverting. I did plug in an extra HDD after the initial installation of Windows. Could that have done something strange to the Windows' equivalent of fstab or something?

    Edit: Oops. Forgot to ask. How would I view/edit the PATH variable on Windows?
    Last edited by Mr Wogan; 12-20-2012 at 01:17 PM.

  4. #4
    Sierra is offline AN21XX
    Join Date
    Mar 2012
    Location
    Munich
    Posts
    297
    Rep Power
    3

    Default Re: I can't get jar to work on the CLI

    I suspect that there is nothing strange about your installtion... I guess you just need to add the location of the jar executable.

    Try to find the path to your jar.exe, it should look like C:\Program Files\Java\jdk1.6.0_21\bin
    Then add it to your PATH variable if it is not already there. Note that I think you need the JDK, not just the runtime java environment.

    You may quick check if your PATH variable is properly set by using "set" in the CLI, which prints you all set variables.

    Take a look here on how to change your PATH variable, as it is different depending on your installation:
    How to set the path in Microsoft Windows
    Last edited by Sierra; 12-20-2012 at 01:41 PM.
    I like likes!

  5. #5
    Mr Wogan is offline Member
    Join Date
    Dec 2012
    Posts
    14
    Rep Power
    0

    Default Re: I can't get jar to work on the CLI

    Isn't the JDK installation process supposed to add the path for me? Maybe it was because I installed the NetBeans and JDK all-in-one one bundle instead of just doing it seperately?. I remember reading someone complaining about the all-in-one bundle a few years ago but I didn't know if they were just having a whinge because they'd broken something, or if there actually was a good reason why you might want install them separately (other than not wanting to use Netbeans, obviously).

    Thanks for the help, anyway. I'll get on with making the changes.

Similar Threads

  1. Replies: 2
    Last Post: 11-25-2012, 03:51 AM
  2. Why. Does. This. Not. Work.
    By Kaytes in forum New To Java
    Replies: 1
    Last Post: 04-06-2012, 08:50 PM
  3. applet call dll work in Win2000 but not work in WinXP
    By manhcuongtin4 in forum Java Applets
    Replies: 1
    Last Post: 07-14-2011, 02:45 PM
  4. Cant seem to get this to work
    By nivekeleets in forum Java 2D
    Replies: 4
    Last Post: 11-13-2010, 08:09 PM
  5. how would i get this to work...?
    By deeadeed in forum New To Java
    Replies: 6
    Last Post: 12-06-2007, 03:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •