diff options
| author | Jussi Pakkanen <jpakkane@gmail.com> | 2022-07-03 17:39:59 +0300 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2022-07-03 17:39:59 +0300 |
| commit | 9c6dab2cfd310ef2d840a2a7a479ce6b9e563b1d (patch) | |
| tree | 983bed70068da2fb12c7d5ecafb0bb31e2e99720 /docs/markdown/snippets/jar-resources.md | |
| parent | 51dad83d465363b9de18885d0047897f8a211e53 (diff) | |
| download | meson-9c6dab2cfd310ef2d840a2a7a479ce6b9e563b1d.tar.gz | |
Finalize the release.
Diffstat (limited to 'docs/markdown/snippets/jar-resources.md')
| -rw-r--r-- | docs/markdown/snippets/jar-resources.md | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/docs/markdown/snippets/jar-resources.md b/docs/markdown/snippets/jar-resources.md deleted file mode 100644 index 12b0c8100..000000000 --- a/docs/markdown/snippets/jar-resources.md +++ /dev/null @@ -1,34 +0,0 @@ -## JAR Resources - -The ability to add resources to a JAR has been added. Use the `java_resources` -keyword argument. It takes a `sturctured_src` object. - -```meson -jar( - meson.project_name(), - sources, - main_class: 'com.mesonbuild.Resources', - java_resources: structured_sources( - files('resources/resource1.txt'), - { - 'subdir': files('resources/subdir/resource2.txt'), - } - ) -) -``` - -To access these resources in your Java application: - -```java -try (InputStreamReader reader = new InputStreamReader( - Resources.class.getResourceAsStream("/resource1.txt"), - StandardCharsets.UTF_8)) { - // ... -} - -try (InputStreamReader reader = new InputStreamReader( - Resources.class.getResourceAsStream("/subdir/resource2.txt"), - StandardCharsets.UTF_8)) { - // ... -} -``` |
