How does one package a jar file using java code? I want a .jar file to be created with custom code whenever (for example) a button is pressed, how would I do this? There doesn't seem to be any documentation about this so I figured I would go here, I've tried searching everywhere on the web.
Yes, this is possible.
JavaCompiler
JavaCompiler
compiles it and returns the bytecodeJarOutputStream
with a manifest that declares the main class.Baeldung: Compiling and Executing Code From a String in Java