{"id":15047986,"url":"https://github.com/gershnik/simplejni","last_synced_at":"2026-04-27T11:01:10.672Z","repository":{"id":57733314,"uuid":"415216555","full_name":"gershnik/SimpleJNI","owner":"gershnik","description":"A powerful lightweight C++ wrapper for JNI","archived":false,"fork":false,"pushed_at":"2026-04-27T06:42:16.000Z","size":1300,"stargazers_count":19,"open_issues_count":1,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-04-27T07:20:50.770Z","etag":null,"topics":["cplusplus","cplusplus-17","cplusplus-20","cpp","cpp17","cpp20","jni","jni-android","jni-android-library","jni-wrapper"],"latest_commit_sha":null,"homepage":"","language":"C++","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/gershnik.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-10-09T05:55:51.000Z","updated_at":"2026-04-08T19:41:03.000Z","dependencies_parsed_at":"2023-11-02T08:44:19.251Z","dependency_job_id":"e2bc9ada-8781-409b-9158-ce24c9eb4423","html_url":"https://github.com/gershnik/SimpleJNI","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/gershnik/SimpleJNI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gershnik%2FSimpleJNI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gershnik%2FSimpleJNI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gershnik%2FSimpleJNI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gershnik%2FSimpleJNI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gershnik","download_url":"https://codeload.github.com/gershnik/SimpleJNI/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gershnik%2FSimpleJNI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32333199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"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":["cplusplus","cplusplus-17","cplusplus-20","cpp","cpp17","cpp20","jni","jni-android","jni-android-library","jni-wrapper"],"created_at":"2024-09-24T21:06:33.199Z","updated_at":"2026-04-27T11:01:10.656Z","avatar_url":"https://github.com/gershnik.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleJNI library #\n\n[![Language](https://img.shields.io/badge/language-C++-blue.svg)](https://isocpp.org/)\n[![Standard](https://img.shields.io/badge/C%2B%2B-17-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization)\n[![License](https://img.shields.io/badge/license-Apache%202-brightgreen.svg)](https://opensource.org/license/apache-2-0/)\n![Android](https://img.shields.io/badge/Android-F5F5F5?style=flat\u0026logo=android\u0026logoColor=green)\n![JVM](https://img.shields.io/badge/JVM-F5F5F5?style=flat\u0026logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDov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TEuMzM2IDYuNzg2IDQuMDA3LTEuMjMgNi4wOSAwIDAgLjA1My0uMDUzLjEwNy0uMTZ6bS05LjgzIDguNDQyYzUuNzcuMzc0IDE0LjU4Ny0uMjE0IDE0LjgtMi45NCAwIDAtLjQyNyAxLjA3LTQuNzU1IDEuODctNC45MTYuOTA4LTExLjAwNy44LTE0LjU4Ny4yMTQgMCAwIC43NDguNjQgNC41NDIuODU1eiIgZmlsbD0iIzRlNzg5NiIvPjxwYXRoIGQ9Ik0xOC45OTYuMDAxczMuMzEzIDMuMzY2LTMuMTUyIDguNDQyYy01LjE4MyA0LjExNC0xLjE3NSA2LjQ2NSAwIDkuMTM3LTMuMDQ2LTIuNzI1LTUuMjM2LTUuMTMtMy43NC03LjM3M0MxNC4yOTQgNi44OTMgMjAuMzMyIDUuMyAxOC45OTYuMDAxem0tMS43IDE1LjMzNWMxLjU1IDEuNzYzLS40MjcgMy4zNjYtLjQyNyAzLjM2NnMzLjk1NC0yLjAzIDIuMTM3LTQuNTQyYy0xLjY1Ni0yLjQwNC0yLjk0LTMuNTggNC4wMDctNy41ODcgMCAwLTEwLjk1MyAyLjcyNS01LjcxNyA4Ljc2M3oiIGZpbGw9IiNmNTgyMTkiLz48L3N2Zz4=)\n[![Tests](https://github.com/gershnik/SimpleJNI/actions/workflows/test.yml/badge.svg)](https://github.com/gershnik/SimpleJNI/actions/workflows/test.yml)\n\n\nA powerful lightweight C++ wrapper for JNI\n\n**Note**: this library is based on SmJNI (https://github.com/smartsheet-mobile/smjni) developed by the same author. The SmJNI library is no longer actively maintained and all further enhancements will happen here. \n\n## Purpose\n\nWriting C++ code for JNI is hard, error prone and unsafe. The purpose of this library is to make it easy and safe.\nIt targets two main scenarios\n\n1. Call Java code from C++\n2. Implement native Java methods in C++\n\nThe approach this library is taking is different from SWIG and JNA. Unlike either it does not attempt to easily\nexpose existing C or C++ code to Java. Trying to do so is, in my opinion, rarely a good idea. Instead it does\nexactly the opposite: easily exposes Java to C++.\nWith this library if you want to simply connect existing C++ code to Java you will need to write your own wrappers.\nHowever, doing so will become easy and straightforward. As will be more sophisticated things like implementing\nclasses partially natively or using Java from within C++ application.\n\n### Goals\n\n*    Never have to figure out things like `([BLjava/lang/String;)Ljava/lang/Throwable;`\n*    Never have to call vararg (...) functions hoping that you got the arguments right. And debug weird behavior when you didn't...\n*    Type safety: never have to worry \"is this `jobject` what I think it is?\"\n*    RAII wrappers for anything that has do/undo semantics\n*    Proper error handling. Use exceptions instead of error-prone and ill-defined manual checks.\n     If Java call threw an exception it should automatically become C++ exception. You should also be able to easily\n     convert it back to Java when returning from JNI call. \n*    Dealing with JNI local/global reference stuff should be safe and easy by default. \n*    It should be possible to access Java arrays via STL collection interface. \n*    You should never have to deal with *modified UTF-8*. All string operations should either use UTF-16 or standard UTF-8\n*    It should be possible to get the JNIEnv in arbitrary C++ code without the trouble of passing it through every call.\n*    You shouldn't need to find Java classes again and again every time you want to use them.\n*    All of the above should be accomplished without sacrificing performance compared to \"raw\" JNI use. However, if there\n     is an unavoidable choice between marginal performance gain and correctness/safety the later should win.\n*    All of the JNI functionality required to write correct code should be available in the library. There should never be a need\n     to manually invoke `JNIEnv` methods. Conversely dangerous (e.g. `ThrowNew`) and unnecessary JNI methods should not\n     be exposed.\n*    Modularity: it should be possible to mix and match parts of library with hand written JNI code if desired. It should not\n     force all or nothing approach.\n\n### Non-Goals\n\n*    Automatically expose C or C++ code to Java\n*    Completely hide JNI fundamentals: existence of per thread `JNIEnv *`, global/local reference semantics etc. from C++ code\n*    Provide C++ wrappers for common Java classes\n*    Provide Java wrappers for common C++ classes\n*    Support old C++ compilers and libraries. This library requires C++17. \n\n## Building\n\nInstructions on how to build SimpleJNI are available on project [wiki](https://github.com/gershnik/SimpleJNI/wiki/Building)\n\n## User's Guide\n\nUser's guide (work in progress) is also available on [wiki](https://github.com/gershnik/SimpleJNI/wiki/User%27s-Guide)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgershnik%2Fsimplejni","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgershnik%2Fsimplejni","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgershnik%2Fsimplejni/lists"}