Results 1 to 2 of 2
  1. #1
    FFK is offline Member
    Join Date
    Sep 2012
    Rep Power

    Post Placing .class files into a JAR through Java?


    I am trying to make a program that can drop .class files into a JAR. Is this even possible? If so, how can I go about doing it?


  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    New Zealand
    Rep Power

    Default Re: Placing .class files into a JAR through Java?

    .jar archive files are a sort of .zip archive file, and there are methods available in the standard library to read and write both sorts of archive. If you add a GUI to the underlying task of writing an entry into a .jar archive, then, yes, you can drop files (including .class files) into a .jar archive.

    There is a Technical Article on Compressing and Decompressing Data Using Java APIs which describes what these archives are and how you access them using Java. The focus is on .zip archives but, as the author states, what he says carries over to .jar archives. have numerous code examples specifically relating to .jar archives: including writing entries and the manifest. The Technical Article and the API documentation are worth reading to make sense of the code. Also - since you posted this in "New To Java" - make sure you are happy basic file i/o first.

Similar Threads

  1. Decompiling java class files
    By ancr2001 in forum New To Java
    Replies: 11
    Last Post: 05-15-2012, 05:59 PM
  2. How can i encrypt java class files
    By synclenovo in forum Advanced Java
    Replies: 1
    Last Post: 03-31-2009, 07:08 AM
  3. Placing Files In Folder
    By ramesh.8189 in forum New To Java
    Replies: 0
    Last Post: 02-06-2009, 12:36 PM
  4. conversion of java .class files to .java files
    By kotturupraveen in forum New To Java
    Replies: 2
    Last Post: 06-09-2008, 12:58 PM
  5. Replies: 2
    Last Post: 12-04-2007, 10:49 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