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 3 of 3

Thread: Urgent! How to compile a whole library to Jar

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Urgent! How to compile a whole library to Jar

    Hi,

    I hope someone can help asap:

    I downloaded the source code zip of a java library, opened it up and changed a few lines in a few .java files.
    Now I want to compile the ENTIRE library to one JAR file, using eclipse. How can I do that? I tried the import/export, but I'm not even sure what exactly should be imported.

    I'd appreciate a step-by-step guide.

    Thx so much!!!


  2. #2
    Member
    Join Date
    Apr 2012
    Location
    Superior, CO, USA
    Posts
    80
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default Re: Urgent! How to compile a whole library to Jar

    How did you extract the files from the original jar file - with the "jar" command perhaps? You do the same thing with "re-jarring" the file. Just have the files (including the directory META-INF in a directory) and do a:

    jar -cf filename.jar META-INF com

    assuming that the .class files are in the "com" directory. Change as needed.
    Need Java help? Check out the HotJoe Java Help forums!

  3. The Following User Says Thank You to stdunbar For This Useful Post:

    JavaCup (May 11th, 2012)

  4. #3
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,707
    Thanks
    25
    Thanked 338 Times in 313 Posts

    Default Re: Urgent! How to compile a whole library to Jar

    A jar file is just a zip file with a different extension. If it is just a library (opposed to an executable jar), I think you can just put all the .class files (you get a .class file when you compile a .java file) in a zip folder, and change the extension from .zip to .jar.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  5. The Following User Says Thank You to aussiemcgr For This Useful Post:

    JavaCup (May 11th, 2012)

Similar Threads

  1. Need urgent help regarding java word wrap function.. URGENT
    By coldice in forum What's Wrong With My Code?
    Replies: 3
    Last Post: August 16th, 2011, 06:43 AM
  2. Where to place my own library?
    By hexwind in forum Java Theory & Questions
    Replies: 3
    Last Post: June 22nd, 2011, 07:25 AM
  3. how to use SteelSeries library?
    By aang in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 22nd, 2010, 12:57 PM
  4. Powerpoint Library
    By aussiemcgr in forum Java Theory & Questions
    Replies: 0
    Last Post: July 22nd, 2010, 09:26 AM
  5. library
    By b109 in forum Java Theory & Questions
    Replies: 2
    Last Post: May 3rd, 2010, 06:32 AM