How can I generate a .class file with my Java application?
Well, you could generate Java source code and then e.g., invoke a Java source code compiler on it. Of course, you're probably more interested in being able to more or less directly manipulate Java bytecodes to build/modify
.class files. Check out:
JavaClass, Java Bytecode Assembler, Jasmin, and Trove.