{"id":19911001,"url":"https://github.com/leaningtech/cheerpj-natives","last_synced_at":"2025-05-03T03:30:56.801Z","repository":{"id":213361336,"uuid":"733911685","full_name":"leaningtech/cheerpj-natives","owner":"leaningtech","description":"JS implementations of JNI libraries for CheerpJ","archived":false,"fork":false,"pushed_at":"2024-05-13T07:59:11.000Z","size":38,"stargazers_count":11,"open_issues_count":2,"forks_count":5,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-07T10:51:26.233Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/leaningtech.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":"2023-12-20T12:15:59.000Z","updated_at":"2024-12-23T14:06:28.000Z","dependencies_parsed_at":"2024-04-05T15:51:56.192Z","dependency_job_id":"b662baa2-fe83-4879-8be0-4e233f30d553","html_url":"https://github.com/leaningtech/cheerpj-natives","commit_stats":null,"previous_names":["leaningtech/cheerpj-natives"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leaningtech%2Fcheerpj-natives","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leaningtech%2Fcheerpj-natives/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leaningtech%2Fcheerpj-natives/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leaningtech%2Fcheerpj-natives/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leaningtech","download_url":"https://codeload.github.com/leaningtech/cheerpj-natives/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252137517,"owners_count":21700228,"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":"2024-11-12T21:22:56.232Z","updated_at":"2025-05-03T03:30:56.570Z","avatar_url":"https://github.com/leaningtech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cheerpj-natives\n\n[![Discord server](https://img.shields.io/discord/988743885121548329?color=%237289DA\u0026logo=discord\u0026logoColor=ffffff)](https://discord.leaningtech.com)\n\nA collection of alternative implementations of [native libraries](https://labs.leaningtech.com/cheerpj3/guides/Implementing-Java-native-methods-in-JavaScript) to be used when running Java applications with [CheerpJ](https://labs.leaningtech.com/cheerpj).\n\nCurrently only a partial implementation of LWJGL is included.\n\n# Usage\n\n1. [Download cheerpj-natives](https://github.com/leaningtech/cheerpj-natives/archive/refs/heads/main.zip) and place the `cheerpj-natives` folder at the root of your web server.\n2. Pass the following property to the `cheerpjInit` options: `javaProperties: [\"java.library.path=/app/cheerpj-natives/natives\"]`\n\n## LWJGL\n\nThe LWJGL implementation requires that you provide a canvas for it to render to by setting `window.lwjglCanvasElement`.  If you don't do this, you'll see the following error:\n\n\u003e Error: window.lwjglCanvasElement is not set or is not a canvas\n\n1. Add this HTML to the start of the document body:\n```html\n\u003ccanvas id=\"lwjgl\" width=\"800\" height\"600\"\u003e\u003c/canvas\u003e\n```\n2. In your script, add the following line before the `cheerpjRunMain` or `cheerpjRunJar` call:\n```js\nwindow.lwjglCanvasElement = document.getElementById(\"lwjgl\");\n```\n\n### Example\n\nFollowing from the [getting started tutorial](https://labs.leaningtech.com/cheerpj3/getting-started/Java-app):\n\n```html\n\u003ccanvas id=\"lwjgl\"\u003e\u003c/canvas\u003e\n\u003cscript type=\"module\"\u003e\n  await cheerpjInit({\n    javaProperties: [\"java.library.path=/app/cheerpj-natives/natives\"],\n  });\n  cheerpjCreateDisplay(800, 600);\n  window.lwjglCanvasElement = document.getElementById(\"lwjgl\");\n  await cheerpjRunJar(\"/app/CHANGEME.jar\");\n\u003c/script\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleaningtech%2Fcheerpj-natives","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleaningtech%2Fcheerpj-natives","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleaningtech%2Fcheerpj-natives/lists"}