Decorative site banner
Project icon

com.io7m.jade

  • About
  • Releases
  • Manual
  • Sources
  • License
  • Issues
Maven Central Version Maven Snapshot Code Coverage

jade


The jade package provides an API for following good application directory etiquette.

Features


  • API for handling application data directories.
  • Implements the XDG Basedir specification on Unix-like platforms.
  • Implements best-practice directory management on Windows platforms.
  • Support for portable applications.
  • High-coverage automated test suite.
  • Written in pure Java 17.
  • OSGi-ready.
  • JPMS-ready.
  • ISC license.

Usage


Modules


Applications use jade via the com.io7m.jade.api module, but should also have the com.io7m.jade.vanilla module on the class/module path. If the com.io7m.jade.vanilla module is not available, the jade package will unconditionally return paths equivalent those returned by portable mode.

Using Directories


The jade package selects a set of application paths based on the current operating system and the given configuration information. Getting access to the basic set of application directories for an application named Widget is straightforward:

final var configuration = ApplicationDirectoryConfiguration.builder() .setApplicationName("Widget") .build(); final var directories = ApplicationDirectories.get(configuration); System.out.println("Configuration directory: " + directories.configurationDirectory()); System.out.println("Data directory: " + directories.dataDirectory()); System.out.println("Cache directory: " + directories.cacheDirectory());

Portable Mode


Applications, particularly on Windows, often want to run in portable mode. Portable mode essentially means that all of the paths used by the application are given relative to the initial working directory of the application. This is typically used to facilitate running applications from removable USB storage devices without saving any data to the host operating system storage.

The jade API allows for specifying the name of a system property that will be consulted in order to determine if the application wants to run in portable mode. If the named system property has a value parsed as true, the API will return paths relative to the application rather than system-specific paths.

final var configuration = ApplicationDirectoryConfiguration.builder() .setApplicationName("Widget") .setPortablePropertyName("com.io7m.example.portable") .build(); System.setProperty("com.io7m.example.portable", "true"); final var directories = ApplicationDirectories.get(configuration); System.out.println("Configuration directory: " + directories.configurationDirectory()); System.out.println("Data directory: " + directories.dataDirectory()); System.out.println("Cache directory: " + directories.cacheDirectory());

Override


The jade API allows for specifying the name of a system property that will be consulted in order to determine if the application wants to override the directory used to calculate application directories. If the named system property exists, the value of the property will be treated as a path, and all application directories will be calculated relative to this path.

final var configuration = ApplicationDirectoryConfiguration.builder() .setApplicationName("Widget") .setOverridePropertyName("com.io7m.example.override") .build(); System.setProperty("com.io7m.example.override", "/tmp/x"); final var directories = ApplicationDirectories.get(configuration); // Prints: /tmp/x/config System.out.println("Configuration directory: " + directories.configurationDirectory()); // Prints: /tmp/x/data System.out.println("Data directory: " + directories.dataDirectory()); // Prints: /tmp/x/cache System.out.println("Cache directory: " + directories.cacheDirectory());

Releases & Development Snapshots


Releases


You can subscribe to the atom feed to be notified of project releases.

The most recently released version of the package is 1.0.3.

1.0.3 Release (2024-05-10Z)

  • Update org.junit.jupiter:junit-jupiter-api:5.10.1 → 5.10.2.
  • Update org.immutables:value:2.10.0 → 2.10.1.
  • Update org.junit.jupiter:junit-jupiter-engine:5.10.1 → 5.10.2.
  • Update nl.jqno.equalsverifier:equalsverifier:3.15.5 → 3.16.1.
  • Update ch.qos.logback:logback-classic:1.4.14 → 1.5.6.
  • Update org.mockito:mockito-core:5.8.0 → 5.11.0.
  • Update org.slf4j:slf4j-api:2.0.10 → 2.0.13.
  • Move to new organization.

The compiled artifacts for the release (and all previous releases) are available on Maven Central.

Maven Modules


<dependency> <group>com.io7m.jade</group> <artifactId>com.io7m.jade.api</artifactId> <version>1.0.3</version> </dependency><dependency> <group>com.io7m.jade</group> <artifactId>com.io7m.jade.tests</artifactId> <version>1.0.3</version> </dependency><dependency> <group>com.io7m.jade</group> <artifactId>com.io7m.jade.spi</artifactId> <version>1.0.3</version> </dependency><dependency> <group>com.io7m.jade</group> <artifactId>com.io7m.jade.vanilla</artifactId> <version>1.0.3</version> </dependency>

Previous Releases


The changelogs for the most recent previous releases are as follows:

1.0.2 Release (2024-05-10Z)

  • Require JDK 17 (Backwards incompatible)

1.0.1 Release (2020-04-04Z)

  • Use primogenitor 4.0.1 for reproducible builds

1.0.0 Release (2020-04-04Z)

  • Initial release

Development Snapshots


At the time of writing, the current unstable development version of the package is 1.0.4-SNAPSHOT.

Development snapshots may be available in the Central Portal Snapshots repository. Snapshots are published to this repository every time the project is built by the project's continuous integration system, but snapshots do expire after around ninety days and so may or may not be available depending on when a build of the package was last triggered.

Manual


This project does not have any user manuals or other documentation beyond what might be present on the page above.

Sources


This project uses Git to manage source code.

Repository: https://www.github.com/io7m-com/jade

$ git clone --recursive https://www.github.com/io7m-com/jade

Issues


This project uses GitHub Issues to track issues.

License


Copyright © 2023 Mark Raynsford <code@io7m.com> https://www.io7m.com Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Last Updated 2025-08-09T14:56:13Z