Results 1 to 11 of 11

Thread: JAR files

  1. #1
    Lingerz is offline Member
    Join Date
    Sep 2009
    Posts
    21
    Rep Power
    0

    Default JAR files

    Can someone explain to me in detail how I would pack my files into a JAR file? I've searched around as well as checked out tutorials yet I'm still clueless. :rolleyes:

    Help would be appreciated. :)

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by Lingerz View Post
    Can someone explain to me in detail how I would pack my files into a JAR file? I've searched around as well as checked out tutorials yet I'm still clueless. :rolleyes:
    Help would be appreciated. :)
    I'm not sure what kind of answer you expect here. Understand that you're not asking a specific question, but rather are asking about a general subject, how "in detail" to create Jar files. This subject when discussed in the tutorials takes several pages to describe. I'm not sure how you expect us to answer this better than the tutorials or your textbook or how are we expected to know just what it is you don't understand, much less how we are going to have the time to write essentially a book chapter seeing as how we are all volunteers with jobs/lives/families...

    My suggestion is that you go through the Sun tutorials again but this time taking notes. Then after going through them, review your notes and come on back with any specific questions or misunderstandings that you have.

    You may also want to read this link as I know that it has helped me and others here to ask questions that are more easily answered: How To Ask Questions The Smart Way

    Best of luck!
    Last edited by Fubarable; 01-25-2010 at 08:52 PM.

  3. #3
    Lingerz is offline Member
    Join Date
    Sep 2009
    Posts
    21
    Rep Power
    0

    Default

    I need help with the command.

    At the moment I have:

    Java Code:
    jar cvf Chat.jar *

    In a command file. This causes the above (jar cvf Chat.jar *) to be echoed repeatedly. I'd like to ask, what am I doing wrong?

  4. #4
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    Start with
    Lesson: Packaging Programs in JAR Files
    and work with the section
    Using JAR Files: The Basics
    with special attention to the creating, viewing and running sections.
    Then work with this page
    Working with Manifest Files: The Basics
    and especially this
    Setting an Application's Entry Point
    It takes patience and practice to work through these tutorial pages.

  5. #5
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    I just made a folder named "jarTest" and copied a source file "A" and its class files into it.
    Navigating to the folder and then executing:
    Java Code:
    jar cvf AJar.jar *
    I got a jar file "AJar" appearing inside the folder and the following output:
    Java Code:
    C:\jexp\jarTest>jar cvf AJar.jar *
    added manifest
    adding: A$1.class(in = 1637) (out= 954)(deflated 41%)
    adding: A$2.class(in = 678) (out= 446)(deflated 34%)
    adding: A$3.class(in = 977) (out= 637)(deflated 34%)
    adding: A.class(in = 7665) (out= 4071)(deflated 46%)
    adding: A.java(in = 14478) (out= 4217)(deflated 70%)

  6. #6
    Lingerz is offline Member
    Join Date
    Sep 2009
    Posts
    21
    Rep Power
    0

    Default

    Exactly how did you execute it? I'm a bit lost. :s

  7. #7
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    how did you execute it
    I typed this at the prompt
    Java Code:
    C:\jexp\jarTest>jar cvf AJar.jar *
    and pressed the enter key.
    This makes a jar file including all files inside the "jarTest" folder.

    Note from the path in the prompt that the current directory is the "jarTest" folder.
    I navigated to that folder with the "cd" command at the prompt
    Java Code:
    C:\jexp>cd jarTest
    and pressing enter, resulting in
    Java Code:
    C:\jexp\jarTest>

  8. #8
    Lingerz is offline Member
    Join Date
    Sep 2009
    Posts
    21
    Rep Power
    0

    Default

    That worked, thanks alot. :)

  9. #9
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,574
    Rep Power
    12

    Default

    @OP You mentioned that you had the command in a command file of some sort. If you had named that file "jar dot some executable extension" then the OS may have got confused and kept on calling the command file rather than the actual jar executable. That would explain the continual display of the command on the screen.

  10. #10
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    bigj, please ask your new question in a new thread. Thanks.

  11. #11
    bigj is offline Member
    Join Date
    Dec 2009
    Posts
    68
    Rep Power
    0

    Default

    oh sorry sir for that.. i thougt it was fine to ask that question with this post to reduce some sort of spamming(relevant topic)... sorry again..

Similar Threads

  1. working with files (text files)
    By itaipee in forum New To Java
    Replies: 1
    Last Post: 02-24-2009, 12:38 PM
  2. Behaving text files like binary files
    By Farzaneh in forum New To Java
    Replies: 2
    Last Post: 08-27-2008, 04:20 PM
  3. Text and image files within jar files
    By erhart in forum Advanced Java
    Replies: 8
    Last Post: 01-19-2008, 05:43 AM
  4. how to convert mpeg files to .wav files
    By christina in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 05:14 AM
  5. convert xls files into pdf files
    By bbq in forum New To Java
    Replies: 3
    Last Post: 07-20-2007, 04:56 AM

Tags for this Thread

Posting Permissions

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