{"id":37027507,"url":"https://github.com/cegredev/josi","last_synced_at":"2026-01-14T03:16:10.846Z","repository":{"id":49898678,"uuid":"358665087","full_name":"cegredev/josi","owner":"cegredev","description":"A Java library designed to make making decisions based on the current operating system easier.","archived":false,"fork":false,"pushed_at":"2021-07-13T21:24:27.000Z","size":315,"stargazers_count":35,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-04T04:50:00.441Z","etag":null,"topics":["java","library","operating-system","utility"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cegredev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-16T16:54:10.000Z","updated_at":"2025-06-09T01:10:56.000Z","dependencies_parsed_at":"2022-09-26T22:11:08.993Z","dependency_job_id":null,"html_url":"https://github.com/cegredev/josi","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/cegredev/josi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cegredev%2Fjosi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cegredev%2Fjosi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cegredev%2Fjosi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cegredev%2Fjosi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cegredev","download_url":"https://codeload.github.com/cegredev/josi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cegredev%2Fjosi/sbom","scorecard":{"id":270415,"data":{"date":"2025-08-11","repo":{"name":"github.com/cegredev/josi","commit":"34bb6506f7cc3dffa8781821b220fa7723196bad"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":2,"reason":"Found 5/22 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yaml:1","Warn: no topLevel permission defined: .github/workflows/sonatype.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/cegredev/josi/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/cegredev/josi/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/cegredev/josi/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/sonatype.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/cegredev/josi/sonatype.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/sonatype.yaml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/cegredev/josi/sonatype.yaml/main?enable=pin","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'","Warn: branch protection not enabled for branch 'release'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 13 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T13:11:16.745Z","repository_id":49898678,"created_at":"2025-08-17T13:11:16.745Z","updated_at":"2025-08-17T13:11:16.745Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","library","operating-system","utility"],"created_at":"2026-01-14T03:16:10.149Z","updated_at":"2026-01-14T03:16:10.841Z","avatar_url":"https://github.com/cegredev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Maven Central](https://img.shields.io/maven-central/v/io.github.cegredev/josi.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22io.github.cegredev%22%20AND%20a:%22josi%22)\n[![javadoc](https://javadoc.io/badge2/io.github.cegredev/josi/javadoc.svg)](https://javadoc.io/doc/io.github.cegredev/josi)\n# Java OS Independence\n...or *JOSI* for short, is a simple and lightweight Java library designed to make making decisions based on the current operating system easier.\n\n## Getting Started\n\nMaven:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.github.cegredev\u003c/groupId\u003e\n  \u003cartifactId\u003ejosi\u003c/artifactId\u003e\n  \u003cversion\u003e0.4.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nGradle:\n\n```gradle\ndependencies {\n  implementation 'io.github.cegredev:josi:0.4.1'\n}\n```\n\nOr download the jars directly from [Maven Central](https://search.maven.org/artifact/io.github.cegredev/josi).\n\n### How's it work?\n\nThe [OS](https://javadoc.io/page/io.github.cegredev/josi/latest/io/github/cegredev/josi/OS.html) enum is the heart of the library and contains the current operating system:\n\n```java\nOS os = OS.current();\n```\n\n...which can be anything from to `WIN_7` to `MAC_OS_BIG_SUR` to `UBUNTU`.\n\nThe more useful information is the [Family](https://javadoc.io/page/io.github.cegredev/josi/latest/io/github/cegredev/josi/OS.Family.html) of the operating system, i.e. `WINDOWS`, `MAC`, `LINUX` or `OTHER`. You can get it like this:\n\n```java\nOS.Family family = os.getFamily();\n```\n\n...and then use it to execute code based on it like this:\n\n```java\nswitch (family) {\n\tcase WINDOWS:\n\t\t// ...\n\tcase MAC:\n\t\t// ...\n\tcase LINUX:\n\t\t// ...\n\tcase OTHER:\n\t\t// ...\n}\n```\n\nThis is pretty much all you need to know, but I strongly encourage you to take a look at the other examples below and the [documentation](https://javadoc.io/doc/io.github.cegredev/josi) to explore some of the utility methods *JOSI* has to offer!\n\n### Examples\n\nCheck whether an operating system is a specific one:\n\n```java\n// Checks whether the OS is any of the given ones\nboolean isHated = OS.current().is(OS.WIN_8, OS.WIN_8_1);\n\n// Checks whether the OS is part of the given families\nboolean isUnixBased = OS.current().isFamily(OS.Family.MAC, OS.Family.LINUX);\n```\n\nEnforce a specific operating system:\n\n```java\n// Throws an exception if the operating system is one of the given ones\nOS.current().enforceNot(OS.WIN_95, OS.WIN_98, OS.WIN_XP);\n\n// Throws an exception if the operating system family is not part of the given ones\nOS.current().enforceFamily(OS.Family.WINDOWS, OS.Family.MAC);\n\n// Only returns the value if the current operating system is Windows, otherwise throws an exception.\n// Useful for one-liners where you want to assign a value and check for the OS in the same step.\nboolean gamer = OS.current().pickWindows(true);\n```\n\nChoose a value based on the current operating systems's family:\n\n```java\n// Chooses the correct value based on the current operating system:\n// On Windows: \"Windows\", on Mac: \"Mac\", on Linux: \"Linux\", on other: \"Other\"\nString currentOS = OS.current().pick(\"Windows\", \"Mac\", \"Linux\", \"Other\");\n\n// Chooses the correct value between Mac, Linux or anything else, for example:\n// On Windows: \"other\", on Mac: \"creative\", on Linux: \"techy\", on other: \"other\"\nString character = OS.current().pickMacLinuxAny(\"creative\", \"techy\", \"other\");\n\n// Chooses the correct value between Linux and anything else, for example:\n// On Linux: false, on Windows, Mac or anything else: true\nboolean filthyCasual = OS.current().pickLinuxAny(false, true);\n\n// There is one of these methods for every single combination, all following the same naming scheme,\n// so you can probably even guess their names with looking at the... d o c u m e n t a t i o n .\n```\n\nExecute code based on the current operating system:\n\n```java\n// There are basically two ways to achieve this. The first and simplest is the following:\n// Since we often don't care about which exact version of an operating system we are running, we are\n// just using the family of the current OS, which can be one of the below values.\nswitch (OS.current().getFamily()) {\n\tcase WINDOWS:\n\t\tSystem.out.println(\"Windows!\");\n\t\tbreak;\n\tcase MAC:\n\t\tSystem.out.println(\"Mac!\");\n\t\tbreak;\n\tcase LINUX:\n\t\tSystem.out.println(\"Linux!\");\n\t\tbreak;\n\tcase OTHER:\n\t\tSystem.out.println(\"Other!\");\n\t\tbreak;\n}\n\n// If you need more control, you can of course switch on the OS itself as well. However, this is more\n// error-prone as there are lots more enum constants for the OS datatype, so you should use the family\n// whenever possible.\nswitch (OS.current()) {\n\tcase WIN_95:\n\t\tSystem.out.println(\"Upgrade your PC, my god!\");\n\t\tbreak;\n\tcase WIN_8:\n\tcase WIN_8_1:\n\t\tSystem.out.println(\"You are... special!\");\n\t\tbreak;\n\tcase WIN_7:\n\tcase WIN_10:\n\t\tSystem.out.println(\"You are awesome!\");\n\t\tbreak;\n}\n```\n\n## Contributing\n\nHere are some of the things you could do:\n\nAdd a new operating system for the [OS enum](https://github.com/cegredev/josi/blob/main/src/main/java/io/github/cegredev/josi/OS.java): If you happen to be running one not present already, please add it! Since I'm a solo-developer running Windows, I can't possibly test and add every single one there is, so every little bit of help is appreciated! If you want to know more, take a look at [this guide](https://github.com/cegredev/josi/wiki/How-to-add-an-operating-system-to-the-OS-enum).\n\nAdd a new utility method to the OS enum, but only if you are convinced that it can be useful in many circumstances, as the library should be kept lightweight and not be bloated.\n\nTest the code on your machine, i.e. check if it actually returns the correct operating system for you.\n\nMake suggestions, i.e. if you want to contribute larger changes to the project, create a pull requets or issue and if it fits, I'll be glad to implement it!\n\n## Support\n\nTake a look at the [documentation](https://javadoc.io/doc/io.github.cegredev/josi) or feel free to open an issue, I'm happy to help!\n\n## License\n\nThis project is licensed under the [MIT License](https://github.com/cegredev/java-os-independence/blob/main/LICENSE), but if you don't credit me in your project, that's fine.\n\nI do not believe this library is a unique or noteworthy accomplishment, but rather just an attempt at standardizing something people did on their own for a long time anyways and therefore don't feel like I deserve any more more credit than owning the repository. On the other hand I ask you to please contribute any changes you make to the code and others may benefit from back to the project, so it can continue to grow.\n\nNote: The first major release `0.1.0` was licensed under the Apache 2.0 license by accident and although the abovementioned philosophy is the same, the legal aspects of course still apply in theory, so keep that in mind.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcegredev%2Fjosi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcegredev%2Fjosi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcegredev%2Fjosi/lists"}