Skip to main content

Sharing code

How a program gets at code and files that are not its own, and how yours gets out to other people.

Being written​

Resource files — put a file under src/main/resource/ and read it with Resources.data("path"). Two things worth knowing before you try it: the path is checked when you build, not when you run, so a wrong one is a build error that lists what your program does ship; and the file's extension must be one the compiler knows, or the build refuses rather than guessing a type for it.

Publishing a library — a library by its coordinate, fetched by a build that names it and checked against the .sha256 published beside it.

Where it stands​

Resource files are nearly ready: Resources.data already runs on a board inside the Build HAT library, which reads its own firmware that way. The page waits on its own program running, like every other.

Publishing is the one place here where the tutorial is ahead of the path. Every step has to be done once, for real, before it is written down — and any step that does not work yet gets said so rather than described from the design.