Question

Hello you wonderful people,

All is not right with the world! I am trying to use JSON to persist objects in a java program. I don't use java often, and I'm using JSON to serialize my obejcts because I want other programs written in other languages to be able to adopt these serialized objects as well. My problem is that I can't figure out the correct place to put my JSON files. Initially I though that I should put them in a resources folder, but it seems that it is not possible to write files to resource folders on the fly. I could of course put the files in a folder that is external to my project, but that would kind of bug me ... a lot.

It's these kinds of silly nuances that have always turned me off to java. any comments/suggestions/cold, heartless criticisms would be welcome.

thanks.

Was it helpful?

Solution

I interpret your question something like this: You want to generate JSON files at runtime and write them to your resources folder.

This is not how it is supposed to work – the resources folder is used to contain non-sourcecode files that are used by the program but are included in the distribution, like a Spring application context XML file.

If you want to exchange data with other programs (possibly written in other languages) you should probably use a common exchange directory outside of your program's source tree.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top