I've been working on adding a class to a JAR (somefilename.jar) archive, so that I can add functionality to it.

  1. First, unzip somefilename.jar to a directory, such as c:\somedirectory.
  2. In Eclipse, create a new project, say, TestNewClassProj.
  3. Then, in Project Properties, add External Class Folder, c:\somedirectory.
  4. Create a new class, say, testMyNewClass into the package w.x.y which exists in the JAR.
  5. Optionally, create a static main method to test the new class.
  6. Compile the project.
  7. Using a zip archiver, copy testMyNewClass.class into the w\x\y directory of somefilename.jar
And that's how you can add a class to a JAR. Doing this isn't really useful, unless one of the classes within the JAR file implements class searching and invoking of classes during runtime.