{"id":13468080,"url":"https://github.com/arnetheduck/j2c","last_synced_at":"2025-04-09T14:14:53.686Z","repository":{"id":2316596,"uuid":"3276818","full_name":"arnetheduck/j2c","owner":"arnetheduck","description":"Java to C++ translator","archived":false,"fork":false,"pushed_at":"2018-05-09T00:53:28.000Z","size":1176,"stargazers_count":252,"open_issues_count":0,"forks_count":124,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-04-02T08:48:24.082Z","etag":null,"topics":["cpp","eclipse","eclipse-plugin","java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arnetheduck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-26T19:48:03.000Z","updated_at":"2025-04-02T06:21:05.000Z","dependencies_parsed_at":"2022-08-31T19:52:51.401Z","dependency_job_id":null,"html_url":"https://github.com/arnetheduck/j2c","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnetheduck%2Fj2c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnetheduck%2Fj2c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnetheduck%2Fj2c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnetheduck%2Fj2c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arnetheduck","download_url":"https://codeload.github.com/arnetheduck/j2c/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054193,"owners_count":21039952,"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":["cpp","eclipse","eclipse-plugin","java"],"created_at":"2024-07-31T15:01:05.212Z","updated_at":"2025-04-09T14:14:53.668Z","avatar_url":"https://github.com/arnetheduck.png","language":"Java","readme":"Introduction\n--\nJ2C will convert Java code into hopefully compilable C++(11) code. It works on\nsource level, translating Java source code constructs into their rough\nequivalents in C++ . The output will be reasonably valid C++ code that looks a\nlot like its Java counterpart and hopefully works mostly the same.\n\nThe translation is based on The Java Language Specification, Third Edition, by\nGosling, James and Joy, Bill and Steele, Guy and Bracha, Gilad (that's\nJava 1.6). The translated code should be valid as specified by the ISO/IEC\n14882:2011 C++ standard (or C++11 as the rest of the world knows it).\n\n*The generated code won't work out of the box - you need to remove or implement\n dependencies such as the JRE.*\n\nStatus\n--\nThis project is an idea I've been wanting to try out written down in code.\nThink of it as a paper napkin with some notes on, but in this case, the notes\ncompile and sometimes spit out working stuff. In other words, no guarantees\nand no quality control label.\n\nThat said, j2c successfully converts most of OpenJDK 6 and SWT 3.7 to C++\nthat compiles and passes a quick ocular inspection. Most *language* features\nof Java 1.6 are covered (i e you'll still need a JDK and runtime).\n\nWith a few patches and implementations of native methods in the converted\nOpenJDK code, the included Hello test prints it's message. A more complete\nexample would need a more complete runtime, either by implementing the native\nand JVM parts of a class library or by implementing the stubs that are\ngenerated for missing dependencies.\n\nThis is the first time I write an Eclipse plugin, so be nice.\n\nInstall / Run\n--\nJ2C comes in the form of an Eclipse plugin. You need at least Eclipse 3.8+ and\nJava 1.6+ to run this plugin!\n\nThe most recent version of the project is available as source code. You can get\nit either from Bitbucket (https://bitbucket.org/arnetheduck/j2c/)\nor github (https://github.com/arnetheduck/j2c).\n\nFrom time to time, a release may appear at the Bitbucket site - see\nhttps://bitbucket.org/arnetheduck/j2c/downloads . About that same\ntime, the update site (https://bitbucket.org/arnetheduck/j2c.site/raw/default/)\nshould be updated.\n\nIf you installed via site, it should just work.\n\nIf you downloaded the jar, copy it to `$ECLIPSE_HOME/dropins`.\n\nIf you downloaded the source code you'll have run the plugin by opening the\nproject in Eclipse and starting a new Eclipse test instance by using the run\nbutton in the plugin.xml overview.\n\nOnce you have the plugin running, set up your Java code as a Java\nProject. Eclipse must be able to compile your code for J2C do to its work!\n\nOnce the Java Project is set up (with all dependencies etc), you can run J2C by\nright-clicking the project (or a class/package) in the 'Project Explorer' or\n'Package Explorer' view and choosing the 'Translate to C++' option. You will\nneed to create a folder for the conversion output - the plugin will tell you\nwhere.\n\nThe generated code will contain references to your JRE (stuff from the `java.*`\npackages), as well as some generic helpers. The JRE dependencies will likely be\nstubbed out in the ext folder in the generated code, and trivial, non-working\nimplementations of the rest can be found in j2c.cpp. You'll need to supplant\nthe converted code with implementations of all JRE features you're using,\nor replace them manually to use equivalents from C++ libraries such as STL.\n\nTesting\n--\nThe test project contains a few cases which should be handled correctly by the\ntranslator (by correctly, I mean that they compile with g++ 4.7). You'll find\na CDT project in ctest that builds using the generated Makefile after running\nthe plugin on the test project.\n\nOutput\n--\nFor each Java class, j2c will output a header file and its implementation.\nInner classes end up in separate .h/.cpp pairs. Native method stubs will be\nput in a separate file for your editing pleasure.\n\nClasses for which there is no source will have a header written as well as\na stub file with empty implementations. Throughout, the heap will be used\nto allocate class instances but no attempt is made to collect garbage -\nI recommend Boehm's garbage collector for that.\n\nWhat's missing (that I can think of right now)\n--\n * Reflection\n * Anything involving byte code (class loading, dynamic code generation, etc)\n * Command line support / build integration\n\nHelping out\n--\nPatches and forks are most welcome, as is testing, but please don't report\nissues unless you also attach a simple test case.\n\nFinal words\n--\nSend me a note if you manage (or not) to do something useful with this\nconverter!\n\nLicensing\n--\nThe project is licensed under the Eclipse Public License 1.0.\n\nThanks\n--\nNo animals were hurt while writing this code, but the Nightwatchman\nmight have sore fingers and throat from all that playing...\n\nHave fun,\nJacek Sieka (arnetheduck using google mail point com)\n","funding_links":[],"categories":["Java"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnetheduck%2Fj2c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farnetheduck%2Fj2c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnetheduck%2Fj2c/lists"}