I use Gradle to manage a Java project. In C# I'm able to set a number of files as embedded resource and access them at runtime.
https://docs.gradle.org/current/userguide/java_plugin.html#sec:java_project_layout says src/main/resources
is for Production resources, such as XML and properties files. Therefore I put my resource files there.
Now how do I access and copy out these files in my Java code?
Many posts talk about classpath, user.dir
, or sort of things. I don't know what they are, but I specifically only deal with these files in the resources folder.
I tried https://stackoverflow.com/a/3923182/746461, it lists thousands of files, which looks like too powerful, and I don't know what is the best way to limit the scope.
Besides, I also need my program to copy out these exact files to, say C:\tmp
, and keep the folder structure. How would I do that?