{"id":28715704,"url":"https://github.com/tamimattafi/jni-calculator","last_synced_at":"2026-04-09T22:54:14.373Z","repository":{"id":296055225,"uuid":"992188896","full_name":"tamimattafi/jni-calculator","owner":"tamimattafi","description":"A simple Java calculator demonstrating the use of native methods via JNI (Java Native Interface) with a C implementation. This project shows how to connect Java and native code for basic arithmetic operations. (AI Generated)","archived":false,"fork":false,"pushed_at":"2025-05-28T19:11:52.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-28T20:05:33.802Z","etag":null,"topics":["ai","ai-agents","c","cpp","cursor","dll","dylib","gpt","gpt-4","java","jni","jni-android","jni-java","native","so"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/tamimattafi.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,"zenodo":null}},"created_at":"2025-05-28T18:56:00.000Z","updated_at":"2025-05-28T19:11:56.000Z","dependencies_parsed_at":"2025-05-28T20:05:38.083Z","dependency_job_id":"c982a63d-5fe1-49a7-bf14-b8fb59ca35bc","html_url":"https://github.com/tamimattafi/jni-calculator","commit_stats":null,"previous_names":["tamimattafi/jni-calculator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tamimattafi/jni-calculator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamimattafi%2Fjni-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamimattafi%2Fjni-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamimattafi%2Fjni-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamimattafi%2Fjni-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tamimattafi","download_url":"https://codeload.github.com/tamimattafi/jni-calculator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamimattafi%2Fjni-calculator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259910742,"owners_count":22930713,"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":["ai","ai-agents","c","cpp","cursor","dll","dylib","gpt","gpt-4","java","jni","jni-android","jni-java","native","so"],"created_at":"2025-06-15T02:11:03.950Z","updated_at":"2026-04-09T22:54:14.302Z","avatar_url":"https://github.com/tamimattafi.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"FULLY GENERATED BY CURSOR AND GPT 4.1 (Including the README file)\n\n# JNI Calculator\n\nA simple Java calculator demonstrating the use of native methods via JNI (Java Native Interface) with a C implementation. This project shows how to connect Java and native code for basic arithmetic operations.\n\n## Structure\n\n```\nproject-root/\n├── src/\n│   ├── main/\n│   │   ├── java/com/attafitamim/demo/jni/calculator/   # Java source files\n│   │   └── jni/                                       # Native C source files\n├── build/                                             # Build output (classes, headers, native libs, JAR)\n│   ├── classes/       # Compiled Java classes\n│   ├── headers/       # Generated JNI headers\n│   ├── lib/           # Compiled native libraries (.dylib/.so)\n│   ├── output/        # Final runnable JAR, manifest, and native library\n│   │   ├── calculator-demo.jar   # Runnable JAR\n│   │   ├── MANIFEST.MF           # Manifest with native library info\n│   │   └── libcalculator.*       # Native library for your platform\n│   └── ...\n├── scripts/                                           # Helper scripts for building, cleaning, running\n│   ├── build.sh           # Build everything and produce runnable JAR\n│   ├── clean.sh          # Clean build output\n│   ├── gen_jni.sh        # Generate JNI headers and C stubs\n│   └── run.sh            # Run the generated JAR\n└── README.md                                         # Project documentation\n```\n\n- **src/main/java/com/attafitamim/demo/jni/calculator/**: Java source code for the calculator and JNI interface.\n- **src/main/jni/**: C source code implementing the native methods.\n- **build/**: All build artifacts, including compiled classes, JNI headers, native libraries, and the output JAR.\n- **build/headers/**: Generated JNI headers.\n- **build/output/**: Final runnable JAR and manifest. The manifest includes information about the native library path used by the application.\n- **scripts/**: Shell scripts to automate building, cleaning, and running the project.\n\n## Available Scripts\n\n- **gen_jni.sh**: Generates JNI headers and C stubs for Java classes with native methods.\n- **build.sh**: Cleans, generates JNI headers, builds native and Java code, and produces a runnable JAR.\n- **clean.sh**: Removes all generated files in the build directory.\n- **run.sh**: Builds the project (if needed) and runs the generated JAR, linking the native library.\n\n## Running\n\nRun the following commands from a bash-compatible shell (Unix/macOS, or Windows with Git Bash):\n\n```bash\n# Build the project and generate the runnable JAR\n./scripts/build.sh\n\n# Run the generated JAR (after building)\n./scripts/run.sh\n# The native library will be loaded from the same directory as the JAR (build/output)\n\n# Clean the build output\n./scripts/clean.sh\n```\n\n---\n\n- Edit `src/main/jni/Calculator.c` to implement native methods.\n- All generated files are in `build/`.\n- The JAR can be used as a library or executed as a standalone program.\n\n## Environment Variables\n\nAll common environment variables used by the build and run scripts are defined in `scripts/env/variables.sh`. You can edit this file to customize paths, output locations, and other settings for your project. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftamimattafi%2Fjni-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftamimattafi%2Fjni-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftamimattafi%2Fjni-calculator/lists"}