{"id":42303816,"url":"https://github.com/timob/jnigi","last_synced_at":"2026-01-27T10:42:45.976Z","repository":{"id":44830560,"uuid":"58757259","full_name":"timob/jnigi","owner":"timob","description":"Golang Java JNI library","archived":false,"fork":false,"pushed_at":"2024-04-11T03:12:31.000Z","size":175,"stargazers_count":185,"open_issues_count":9,"forks_count":44,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-23T09:08:14.313Z","etag":null,"topics":["go","java","jvm","linux"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timob.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":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-13T16:48:52.000Z","updated_at":"2025-03-20T01:36:37.000Z","dependencies_parsed_at":"2023-12-28T06:45:02.764Z","dependency_job_id":"c8af3dc7-af56-4a71-bbfe-6d156abe5b1e","html_url":"https://github.com/timob/jnigi","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/timob/jnigi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timob%2Fjnigi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timob%2Fjnigi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timob%2Fjnigi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timob%2Fjnigi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timob","download_url":"https://codeload.github.com/timob/jnigi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timob%2Fjnigi/sbom","scorecard":{"id":886364,"data":{"date":"2025-08-11","repo":{"name":"github.com/timob/jnigi","commit":"21c53b5cc54a3618ddf63b43d629f477b13cde6e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"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":"Code-Review","score":0,"reason":"Found 2/21 approved changesets -- score normalized to 0","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":"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_test.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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 2-Clause \"Simplified\" 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":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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":"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_test.yaml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/timob/jnigi/ci_test.yaml/master?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating debian:bookworm-slim to debian:bookworm-slim@sha256:b1a741487078b369e78119849663d7f1a5341ef2768798f7b7406c4240f86aef","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 containerImage 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":"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"}},{"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"}}]},"last_synced_at":"2025-08-24T10:12:41.193Z","repository_id":44830560,"created_at":"2025-08-24T10:12:41.193Z","updated_at":"2025-08-24T10:12:41.193Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28812351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T07:41:26.337Z","status":"ssl_error","status_checked_at":"2026-01-27T07:41:08.776Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["go","java","jvm","linux"],"created_at":"2026-01-27T10:42:43.334Z","updated_at":"2026-01-27T10:42:45.967Z","avatar_url":"https://github.com/timob.png","language":"Go","readme":"# JNIGI\nJNI Go Interface.\n\nA package to access Java from Go code. Can be used from a Go executable or shared library.\nThis allows for Go to initiate the JVM or Java to start a Go runtime respectively.\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/timob/jnigi.svg)](https://pkg.go.dev/github.com/timob/jnigi)\n[![Actions](https://github.com/timob/jnigi/actions/workflows/ci_test.yaml/badge.svg)](https://github.com/timob/jnigi/actions?query=branch%3Amaster)\n\n## Module name change\nThe go module name is renamed to `github.com/timob/jnigi` in the branch. Checkout `v2` if you want to retain the old name.\n\n## Install\n``` bash\n# In your apps Go module directory\ngo get github.com/timob/jnigi\n\n# Add flags needed to include JNI header files, change this as appropriate for your JDK and OS\nexport CGO_CFLAGS=\"-I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux\"\n\n# build your app\ngo build\n```\nThe `compilevars.sh` (`compilevars.bat` on Windows) script can help setting the `CGO_CFLAGS` environment variable.\n\n## Finding JVM at Runtime\nThe JVM library is dynamically linked at run time. Use the `LoadJVMLib(jvmLibPath string) error` function to load the shared library at run time.\nThere is a function `AttemptToFindJVMLibPath() string` to help to find the library path.\n\n## Status\n### Testing\nMost of the code has tests. To run the tests using docker:\n``` bash\n# get source\ngit clone https://github.com/timob/jnigi.git\n\ncd jnigi\n\n# build image\ndocker build -t jnigi_test .\n\n# run tests\ndocker run jnigi_test\n```\n\n### Uses\nHas been used on Linux/Windows/MacOS (amd64) Android (arm64) multi threaded apps.\n\n### Note about using on Windows\nBecause of the way the JVM triggers OS exceptions during `CreateJavaVM`, which the Go runtime treats as unhandled exceptions, the code for the Go runtime needs to be changed to allow the JVM to handle the exceptions. See https://github.com/timob/jnigi/issues/31#issuecomment-1668914368 for how to do this.\n\n## Example\n\n```` go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/timob/jnigi\"\n    \"log\"\n    \"runtime\"\n)\n\nfunc main() {\n    if err := jnigi.LoadJVMLib(jnigi.AttemptToFindJVMLibPath()); err != nil {\n        log.Fatal(err)\n    }\n\n    runtime.LockOSThread()\n    jvm, env, err := jnigi.CreateJVM(jnigi.NewJVMInitArgs(false, true, jnigi.DEFAULT_VERSION, []string{\"-Xcheck:jni\"}))\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    hello, err := env.NewObject(\"java/lang/String\", []byte(\"Hello \"))\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    world, err := env.NewObject(\"java/lang/String\", []byte(\"World!\"))\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    greeting := jnigi.NewObjectRef(\"java/lang/String\")\n    err = hello.CallMethod(env, \"concat\", greeting, world)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    var goGreeting []byte\n    err = greeting.CallMethod(env, \"getBytes\", \u0026goGreeting)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // Prints \"Hello World!\"\n    fmt.Printf(\"%s\\n\", goGreeting)\n\n    if err := jvm.Destroy(); err != nil {\n        log.Fatal(err)\n    }\n}\n````\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimob%2Fjnigi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimob%2Fjnigi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimob%2Fjnigi/lists"}