CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: jar file

  1. #1
    Join Date
    Aug 2000
    Posts
    25

    jar file

    Hi,
    if I have three java classes like:
    (1)
    package com.1
    import com.2
    import com.3
    class c1{....}
    (2)
    package com.2
    import com.1
    import com.3
    class c2{....}
    (3)
    package com.3
    import com.1
    import com.2
    class c3{....}
    my problem is that how I can compile them and jar them and use them?
    Thanks in advance



  2. #2
    Join Date
    Sep 2000
    Location
    Melbourne --> Australia
    Posts
    68

    Re: jar file

    Ni how ma?

    You can make a manifest file, by typing the following :

    Manifest-Version: 1.0
    Main-Class: yourClassName.class

    The Main-Class attribute is the class that you
    have the main method in, if this class is
    in your com.1 package and its name is "MyClass"
    then your Main-Class line would look like this:

    Main-Class: com.1.MyClass

    after adding these two lines to a new file
    save this file as
    "MANIFEST.MF"
    make sure you use the quotation marks.
    Then put that file with all of your .java files
    Now go to the command line (dos)
    and type

    jar cmf MANIFEST.MF YourJar.jar com


    a jar file will appear with the everything
    inside it, then you can run it
    with the following:

    java -jar YourJar.jar

    Good Luck
    Phill






Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured