Short answer: You should not store objects into your application's JAR file at runtime. Store them in a file in the file system.
Longer answer:
A JAR file on the classpath is liable to be locked. Or read-only. Or in some circumstances, it could be a transient copy in a download cache directory.
Even if you do manage to write to the JAR, it is unspecified what will happen; e.g. whether or not the objects will be visible until the application JVM is restarted.
So given all of these uncertainties, it is not practical to write data into an application's JAR file(s) at runtime.
Another thing is that people (users, system administrators, IT security staff) assume that JAR files are not modified, and are liable to be alarmed and/or annoyed if an application does this.
Finally, there is no real need to write things to a JAR file at runtime. Anything you need to save could / should be written to the file system in ordinary files. There may be a conventional place to put the files, depending on the platform and the nature of the data, or you can make your own convention ... or get the user to say where to put the data via the application's configuration file or command option.
If I haven't convinced you that you that it is a bad idea, see: How can my Java program store files inside of its .jar file?