{"id":18300526,"url":"https://github.com/eclipse-zenoh/zenoh-java","last_synced_at":"2025-10-25T01:13:29.162Z","repository":{"id":47707612,"uuid":"235378315","full_name":"eclipse-zenoh/zenoh-java","owner":"eclipse-zenoh","description":"Java APIs for zenoh","archived":false,"fork":false,"pushed_at":"2024-10-30T00:02:20.000Z","size":1430,"stargazers_count":15,"open_issues_count":9,"forks_count":14,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-10-30T02:43:58.519Z","etag":null,"topics":["java","scala","zenoh"],"latest_commit_sha":null,"homepage":"http://zenoh.io","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eclipse-zenoh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2020-01-21T15:42:31.000Z","updated_at":"2024-10-10T18:09:42.000Z","dependencies_parsed_at":"2024-01-15T12:54:36.760Z","dependency_job_id":"85ebf6a7-3aaf-4432-b729-a00e2d864d92","html_url":"https://github.com/eclipse-zenoh/zenoh-java","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-zenoh%2Fzenoh-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-zenoh%2Fzenoh-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-zenoh%2Fzenoh-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-zenoh%2Fzenoh-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eclipse-zenoh","download_url":"https://codeload.github.com/eclipse-zenoh/zenoh-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247352196,"owners_count":20925223,"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":["java","scala","zenoh"],"created_at":"2024-11-05T15:12:43.573Z","updated_at":"2025-10-25T01:13:24.133Z","avatar_url":"https://github.com/eclipse-zenoh.png","language":"Kotlin","readme":"\u003cimg src=\"https://raw.githubusercontent.com/eclipse-zenoh/zenoh/main/zenoh-dragon.png\" height=\"150\"\u003e\n\n[![CI](https://github.com/eclipse-zenoh/zenoh-java/actions/workflows/ci.yml/badge.svg)](https://github.com/eclipse-zenoh/zenoh-java/actions/workflows/ci.yml)\n[![Release](https://github.com/eclipse-zenoh/zenoh-java/actions/workflows/release.yml/badge.svg)](https://github.com/eclipse-zenoh/zenoh-java/actions/workflows/release.yml)\n[![Discussion](https://img.shields.io/badge/discussion-on%20github-blue)](https://github.com/eclipse-zenoh/roadmap/discussions)\n[![Discord](https://img.shields.io/badge/chat-on%20discord-blue)](https://discord.gg/2GJ958VuHs)\n[![License](https://img.shields.io/badge/License-EPL%202.0-blue)](https://choosealicense.com/licenses/epl-2.0/)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n# Eclipse Zenoh\n\nThe Eclipse Zenoh: Zero Overhead Pub/sub, Store/Query and Compute.\n\nZenoh (pronounce _/zeno/_) unifies data in motion, data at rest and computations. It carefully blends traditional pub/sub with geo-distributed storages, queries and computations, while retaining a level of time and space efficiency that is well beyond any of the mainstream stacks.\n\nCheck the website [zenoh.io](http://zenoh.io) and the [roadmap](https://github.com/eclipse-zenoh/roadmap) for more detailed information.\n\n----\n\n# \u003cimg src=\"jvm.png\" alt=\"Java\" height=\"150\"\u003e  Java API\n\nThis repository provides a Java compatible Kotlin binding based on the main [Zenoh implementation written in Rust](https://github.com/eclipse-zenoh/zenoh).\n\nThe code relies on the Zenoh JNI native library, which written in Rust and communicates with the Kotlin layer via the Java Native Interface (JNI).\n\n## \u003cimg src=\"doc_icon.png\" alt=\"Zenoh\" height=\"70\"\u003e Documentation\n\nThe documentation of the API is published at [https://eclipse-zenoh.github.io/zenoh-java/index.html](https://eclipse-zenoh.github.io/zenoh-java/index.html).\n\nAlternatively, you can build it locally as [explained below](#building-the-documentation).\n\n----\n\n# How to import\n\n## \u003cimg src=\"android-robot.png\" alt=\"Android\" height=\"50\"\u003e  Android\n\nFirst add the Maven central repository to your `settings.gradle.kts`:\n\n```kotlin\ndependencyResolutionManagement {\n    // ...\n    repositories {\n        mavenCentral()\n    }\n}\n```\n\nAfter that add to the dependencies in the app's `build.gradle.kts`:\n\n```kotlin\nimplementation(\"org.eclipse.zenoh:zenoh-java-android:1.1.1\")\n```\n\n### Platforms\n\nThe library targets the following platforms:\n\n- x86\n- x86_64\n- arm\n- arm64\n\n### SDK\n\nThe minimum SDK is 30.\n\n### Permissions\n\nZenoh is a communications protocol, therefore the permissions required are:\n\n```xml\n\u003cuses-permission android:name=\"android.permission.INTERNET\"/\u003e\n\u003cuses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/\u003e\n```\n\n## \u003cimg src=\"jvm.png\" alt=\"Java\" height=\"50\"\u003e JVM\n\nFirst add the Maven central repository to your `settings.gradle.kts`:\n\n```kotlin\ndependencyResolutionManagement {\n    // ...\n    repositories {\n        mavenCentral()\n    }\n}\n```\n\nAfter that add to the dependencies in the app's `build.gradle.kts`:\n\n```kotlin\nimplementation(\"org.eclipse.zenoh:zenoh-java-jvm:1.1.1\")\n```\n\n### Platforms\n\nFor the moment, the library targets the following platforms:\n\n- x86_64-unknown-linux-gnu\n- aarch64-unknown-linux-gnu\n- x86_64-apple-darwin\n- aarch64-apple-darwin\n- x86_64-pc-windows-msvc\n- aarch64-pc-windows-msvc\n\n----\n\n# How to build it\n\n## What you need\n\nBasically:\n\n- Rust ([Installation guide](https://doc.rust-lang.org/cargo/getting-started/installation.html))\n- Kotlin ([Installation guide](https://kotlinlang.org/docs/getting-started.html#backend))\n- Gradle ([Installation guide](https://gradle.org/install/))\n\nand in case of targeting Android you'll also need:\n\n- Android SDK ([Installation guide](https://developer.android.com/about/versions/11/setup-sdk))\n\n## \u003cimg src=\"jvm.png\" alt=\"JVM\" height=\"50\"\u003e JVM\n\nTo publish a library for a JVM project into Maven local, run\n\n```bash\ngradle publishJvmPublicationToMavenLocal\n```\n\nThis will first, trigger the compilation of Zenoh-JNI in release, and second publish the library into maven local, containing the native library\nas a resource that will be loaded during runtime.\n\n:warning: The native library will be compiled against the default rustup target on your machine, so although it may work fine\nfor you on your desktop, the generated publication may not be working on another computer with a different operating system and/or a different cpu architecture.\n\nOnce we have published the package, we should be able to find it under `~/.m2/repository/org/eclipse/zenoh/zenoh-java-jvm/1.1.1`.\n\nFinally, in the gradle file of the project where you intend to use this library, add mavenLocal to the list of repositories and add zenoh-java as a dependency:\n\n```kotlin\nrepositories {\n    mavenCentral()\n    mavenLocal()\n}\n\ndependencies {\n    implementation(\"org.eclipse.zenoh:zenoh-java-jvm:1.1.1\")\n}\n```\n\n## \u003cimg src=\"android-robot.png\" alt=\"Android\" height=\"50\"\u003e Android\n\nIn order to use these bindings in a native Android project, what we will do is to build them as an Android NDK Library,\npublishing it into Maven local for us to be able to easily import it in our project.\n\nIt is required to have the [NDK (native development kit)](https://developer.android.com/ndk) installed, since we are going to compile Zenoh JNI for multiple\nandroid native targets. The currently used NDK version is **26.0.10792818**.\nIt can be set up by using Android Studio (go to `Preferences \u003e Languages \u0026 Frameworks \u003e Android SDK \u003e SDK Tools`, tick `Show Package Details` and pick the right NDK version),\nor alternatively it can be found [here](https://developer.android.com/ndk/downloads).\n\nThe native platforms we are going to target are the following ones:\n\n- x86\n- x86_64\n- arm\n- arm64\n\nTherefore, if they are not yet already added to the Rust toolchain, run:\n\n```bash\nrustup target add armv7-linux-androideabi; \\\nrustup target add i686-linux-android; \\\nrustup target add aarch64-linux-android; \\\nrustup target add x86_64-linux-android\n```\n\nto install them.\n\nSo, in order to publish the library onto Maven Local, run:\n\n```bash\ngradle -Pandroid=true publishAndroidReleasePublicationToMavenLocal\n```\n\nThis will first trigger the compilation of the Zenoh-JNI for the previously mentioned targets, and secondly will\npublish the library, containing the native binaries.\n\nYou should now be able to see the package under `~/.m2/repository/org/eclipse/zenoh/zenoh-java-android/1.1.1`.\n\nFinally, in the gradle file of the project where you intend to use this library, add mavenLocal to the list of repositories and add zenoh-java-android as a dependency:\n\n```kotlin\nrepositories {\n    mavenCentral()\n    mavenLocal()\n}\n\ndependencies {\n    implementation(\"org.eclipse.zenoh:zenoh-kotlin-android:1.1.1\")\n}\n```\n\nReminder that in order to work during runtime, the following permissions must be enabled in the app's manifest:\n\n```xml\n\u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\n\u003cuses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" /\u003e\n```\n\n## Building the documentation\n\nBecause it's a Kotlin project, we use [Dokka](https://kotlinlang.org/docs/dokka-introduction.html) to generate the documentation.\n\nIn order to build it, run:\n\n```bash\ngradle dokkaGenerate\n```\n\n## Running the tests\n\nTo run the tests, run:\n\n```bash\ngradle jvmTest\n```\n\nThis will compile the native library on debug mode (if not already available) and run the tests afterward against the JVM target.\n\n## Logging\n\nRust logs are propagated when setting the `RUST_LOG` environment variable.\n\nFor instance running the ZPub test as follows:\n\n```bash\nRUST_LOG=debug gradle ZPub\n```\n\ncauses the logs to appear in standard output.\n\nThe log levels are the ones from Rust, typically `trace`, `info`, `debug`, `error` and `warn` (though other log filtering options are available, see \u003chttps://docs.rs/env_logger/latest/env_logger/#enabling-logging\u003e).\n\nAlternatively, the logs can be enabled programmatically through `Zenoh.initLogFromEnvOr(logfilter)`, for instance:\n\n```kotlin\nZenoh.initLogFromEnvOr(\"debug\")\n```\n\n----\n\n# Examples\n\nYou can find some examples located under the [`/examples` folder](examples). Checkout the [examples README file](/examples/README.md).\n\n----\n\n# Old packages\n\nOld released versions were published into Github packages.\n\nIn case you want to use one of the versions published into github packages, add the Github packages repository to your `settings.gradle.kts` as follows:\n\n```kotlin\ndependencyResolutionManagement {\n    // ...\n    repositories {\n        google()\n        mavenCentral()\n        maven {\n            name = \"GitHubPackages\"\n            url = uri(\"https://maven.pkg.github.com/eclipse-zenoh/zenoh-java\")\n            credentials {\n                username = providers.gradleProperty(\"user\").get()\n                password = providers.gradleProperty(\"token\").get()\n            }\n        }\n    }\n}\n```\n\nwhere the username and token are your github username and a personal access token you need to generate on github with package read permissions (see the [Github documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)).\nThis is required by Github in order to import the package, even if it's from a public repository.\n\nThen after that, add the dependency as usual:\n\n```kotlin\ndependencies {\n    implementation(\"org.eclipse.zenoh:zenoh-java-jvm:\u003cversion\u003e\")\n}\n```\n","funding_links":[],"categories":["Official API"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-zenoh%2Fzenoh-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feclipse-zenoh%2Fzenoh-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-zenoh%2Fzenoh-java/lists"}