{"id":15007305,"url":"https://github.com/wille/oslib","last_synced_at":"2025-10-30T11:31:43.436Z","repository":{"id":26410421,"uuid":"29860463","full_name":"wille/oslib","owner":"wille","description":"Java library to easily detect running Operating System, BSD Flavor, Linux Distribution, Desktop Environment and Architecture","archived":false,"fork":false,"pushed_at":"2021-05-03T09:52:17.000Z","size":220,"stargazers_count":28,"open_issues_count":2,"forks_count":13,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-02T08:11:49.370Z","etag":null,"topics":["architecture","bsd","bsd-flavor","desktop-environment","java","java-library","library","linux","linux-distribution","operating-system","os","windows"],"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/wille.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":"2015-01-26T12:38:58.000Z","updated_at":"2024-04-06T10:07:40.000Z","dependencies_parsed_at":"2022-08-29T04:20:11.402Z","dependency_job_id":null,"html_url":"https://github.com/wille/oslib","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wille%2Foslib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wille%2Foslib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wille%2Foslib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wille%2Foslib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wille","download_url":"https://codeload.github.com/wille/oslib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238960440,"owners_count":19559266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["architecture","bsd","bsd-flavor","desktop-environment","java","java-library","library","linux","linux-distribution","operating-system","os","windows"],"created_at":"2024-09-24T19:08:07.546Z","updated_at":"2025-10-30T11:31:37.903Z","avatar_url":"https://github.com/wille.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oslib\n\nJava library to easily detect running Operating System, BSD Flavor, Linux Distribution, Desktop Environment and Architecture\n\n## Examples\n\n### Detecting if running Elementary OS (Linux)\n```java\nAbstractOperatingSystem os = OperatingSystem.getOperatingSystem();\n\nif (os.getType() == OperatingSystem.LINUX) {\n\tLinuxOperatingSystem los = (LinuxOperatingSystem) os;\n\t\n\tif (los.getDistro() == Distro.ELEMENTARY_OS) {\n\t\tSystem.out.println(\"Is running eOS\");\n\t} else {\n\t\tSystem.out.println(\"Is running \" + los.getDisplayString());\n\t}\n}\n```\n\n### Getting all information available about current OS\n```java\nAbstractOperatingSystem os = OperatingSystem.getOperatingSystem();\n\nif (os.getType() == OperatingSystem.MACOS) {\n  \tMacOSOperatingSystem xos = (MacOSOperatingSystem) os;\n   \n   \tif (xos.getVersion() == MacOSVersion.YOSEMITE) {\n   \t\tSystem.out.println(\"Is running Yosemite \" + xos.getVersion().getVersion());\n    \t// Will print: Is running Yosemite 10.10\n  \t}\n   \n   \tSystem.out.println(xos.getDisplayString());\n   \t// Will print (if running mavericks): Mac OS X Mavericks 10.9\n}\n\nif (os.getType() == OperatingSystem.LINUX) {\n\tLinuxOperatingSystem los = (LinuxOperatingSystem) os;\n\t\n\tSystem.out.println(los.getDisplayString());\n\t// Will print (if running Kali): Kali Linux 1.0\n\t\n\tif (los.getArch() == Arch.x86_64) {\n\t\tSystem.out.println(\"Is 64 bit\");\n\t}\n}\n```\n\n### Current Known Compatibility:\n\n_Note:_ These are the only ones I have tested with. Will work well on untested systems, but the checked ones are absolutely working.\nLinux distro and BSD flavor detection after 1.0 is based on [screenFetch](https://github.com/KittyKatt/screenFetch)\n\n- [x] macOS ~~Mac OS X~~\n- [x] Windows\n- [ ] Arch Linux\n- [x] Amazon Linux\n- [x] Fedora\n- [x] Linux Mint\n- [x] Ubuntu\n- [x] Debian\n- [x] CentOS\n- [ ] Crunchbang\n- [ ] Gentoo\n- [ ] Funtoo\n- [x] FreeBSD\n- [x] OpenBSD\n- [ ] NetBSD\n- [ ] DragonFlyBSD\n- [x] OpenSUSE\n- [ ] Mandriva/Mandrake\n- [ ] Slackware\n- [x] Red Hat (RHEL)\n- [ ] Frugalware\n- [x] Peppermint\n- [ ] SolusOS\n- [ ] Mageia\n- [ ] ParabolaGNU/Linux-libre\n- [ ] Viperr\n- [ ] LinuxDeepin\n- [ ] Chakra\n- [ ] Trisquel\n- [x] Manjaro\n- [x] elementary OS\n- [ ] Scientific Linux\n- [x] Kali Linux\n- [ ] Sabayon\n- [ ] NixOS\n- [ ] Crux\n- [ ] Lunar Linux\n- [ ] BLAG\n- [ ] gNewSense\n- [ ] Dragora\n- [ ] Chapeau\n- [ ] KDE neon\n- [ ] Oracle Linux\n- [ ] Qubes\n- [x] Linux (If no distro detected or failed to detect)\n- [x] Solaris\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwille%2Foslib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwille%2Foslib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwille%2Foslib/lists"}