Short answer:
Place the data files outside the binary and send them along with the JAR in a separate folder.
Long:
It looks like you are approaching a problem from the wrong direction. A JAR file is a bit of an executable file ( .exe ) on the Windows platform β a read-only binary file containing code .
You can (although this is bad practice) put some resources, such as data files, multimedia, etc. inside a JAR (e.g. inside .exe ). But the best solution would be to place these resources outside the binary so you can switch them without recompiling / rebuilding.
If you need to change resources on the fly while the application is running, you basically have no choice. Data files must be outside the binary. Once again, you will never see a Windows .exe that will change itself.
source share