{"id":29091229,"url":"https://github.com/sshtools/nih","last_synced_at":"2025-06-28T06:06:09.987Z","repository":{"id":271017520,"uuid":"912162984","full_name":"sshtools/nih","owner":"sshtools","description":"Native Integration Helpers","archived":false,"fork":false,"pushed_at":"2025-05-22T10:17:46.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-22T10:46:05.864Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sshtools.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-04T19:25:49.000Z","updated_at":"2025-05-22T10:17:49.000Z","dependencies_parsed_at":"2025-01-04T20:41:40.102Z","dependency_job_id":null,"html_url":"https://github.com/sshtools/nih","commit_stats":null,"previous_names":["sshtools/nih"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sshtools/nih","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshtools%2Fnih","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshtools%2Fnih/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshtools%2Fnih/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshtools%2Fnih/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sshtools","download_url":"https://codeload.github.com/sshtools/nih/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshtools%2Fnih/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262382743,"owners_count":23302297,"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":[],"created_at":"2025-06-28T06:06:09.269Z","updated_at":"2025-06-28T06:06:09.982Z","avatar_url":"https://github.com/sshtools.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nih\n\n![Maven Build/Test JDK 22](https://github.com/sshtools/nih/actions/workflows/maven.yml/badge.svg)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.sshtools/nih/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.sshtools/nih)\n[![Coverage Status](https://coveralls.io/repos/github/sshtools/nih/badge.svg)](https://coveralls.io/github/sshtools/nih)\n[![javadoc](https://javadoc.io/badge2/com.sshtools/nih/javadoc.svg)](https://javadoc.io/doc/com.sshtools/nih)\n![JPMS](https://img.shields.io/badge/JPMS-com.sshtools.nih-purple) \n\nNIH (or **Native Integration Helper**), is a tiny library for Java 22 and above that helps with loading native libraries. Based on code from JNA, it deals with bundling platform specific libraries along with your application jars, and overcoming some problems with locating such libraries when using the new FFMAPI available in modern Java.\n\n## Configuring your project\n\nThe library is available in Maven Central, so configure your project according to the\nbuild system you use. For example, for Maven itself :-\n\n```xml\n    \u003cdependencies\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.sshtools\u003c/groupId\u003e\n            \u003cartifactId\u003enih\u003c/artifactId\u003e\n            \u003cversion\u003e0.9.0\u003c/version\u003e\n        \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n```\n\n### Snapshots\n\n*Development builds may be available in the snapshots repository*\n\n```xml\n\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003eoss-snapshots\u003c/id\u003e\n        \u003curl\u003ehttps://oss.sonatype.org/content/repositories/snapshots\u003c/url\u003e\n        \u003csnapshots\u003e\n            \u003cenabled\u003etrue\u003c/enabled\u003e\n        \u003c/snapshots\u003e\n        \u003creleases\u003e\n            \u003cenabled\u003efalse\u003c/enabled\u003e\n        \u003c/releases\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n    \n..\n\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.sshtools\u003c/groupId\u003e\n        \u003cartifactId\u003enih\u003c/artifactId\u003e\n        \u003cversion\u003e0.9.1-SNAPSHOT\u003c/version\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n## How To Use With OS Supplied Libraries\n\nSimply use `Native.load()` methods instead of FFMAPIs default methods to obtain a `SymbolLookup`. This deals with several platform specific problems that as of writing, the base Java tools do not deal with (Linux library paths with symbolic links, and Mac OS frameworks do not seem to be handled well). \n\nFor example, `Native.load(\"c\", Arena.ofAuto());` will locate that standard C library. \n\n## How To Use With Bundled Libraries\n\nFirst, include compiled shared libraries as a Java resource (e.g. `src/main/resources`)  in the sub-path `META-INF/shared-libraries/\u003cos\u003e/\u003carch\u003e`. \n\nThen to load the library in Java and obtain a `SymbolLookup`, use `Native.load()` methods.\n\nFor example, say you are working on 64-bit Linux and had a native shared library compiled from `tray.c`. Your native `Makefile` produces a `libtray.so`.\n\nYou would place `libtray.so` into `src/main/resource/META-INF/shared-libraries/linux/x86-64`, and then use `Native.load(\"tray\", Arena.ofAuto())` to obtain the library handle.\n\nIf you then want to add Windows support, you would  then place your `tray.dll` into `src/main/resource/META-INF/shared-libraries/windows/x86-64`.\n\n## Origin\n\nThe 2 classes in this library originated from JNA, but were adapted to be useful with Java's own FFMAPI. This code, and our minor additions to it are licensed under LGPL 2.1 or later and Apache License 2.0. (starting with JNA version 4.0.0).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshtools%2Fnih","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsshtools%2Fnih","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshtools%2Fnih/lists"}