• Firstly, when it comes to conversion from language 'X' to language 'Y', then no program can beat human intentions/efforts.

  • For the above case Java to C++ conversion can be done using programs such as TanglibleSoftware. But for some language constructs which are only supported in Java but not in C++, some work around is surely needed.

  • Consider case: User 'A' hands over his source code to program 'ABCD' for conversion from language 'X' to 'Y', and he assumes to get the result(exact converted code with same behavior) in bare minimal efforts, then user 'A' is calling for a failure.

  • I will not go into syntactic differences between Java & C++, but if one has a good grasp on programming then for unsupported constructs of language 'X', code can always be written to perform those operations in language 'Y' successfully.

Machines can only understand code, but meaning has to be construed by Humans.

But this may not be constrained if we consider artificial intelligence into this context or some 'xyz' technology in near future.

My answer is based on my experience, I am not affiliated to TanglibleSoftware by any means, the above software worked for me, with some efforts made. It might not have worked for some other users.

Answer from Viktor Wolf on Stack Exchange
🌐
GitHub
github.com › digitalgust › tinyj2c
GitHub - digitalgust/tinyj2c: Convert JAVA source to C source, Build standlone binary without any class file. · GitHub
Tinyj2c transfer JAVA source to C source, build as standlone binary, and run without any class file.
Starred by 71 users
Forked by 17 users
Languages   Java 76.5% | C 23.3%
🌐
GitHub
github.com › arnetheduck › j2c
GitHub - arnetheduck/j2c: Java to C++ translator · GitHub
J2C will convert Java code into hopefully compilable C++(11) code. It works on source level, translating Java source code constructs into their rough equivalents in C++ .
Starred by 265 users
Forked by 75 users
Languages   Java 95.8% | C++ 4.2%
🌐
GitHub
github.com › ivmai › JCGO
GitHub - ivmai/JCGO: Java source to C code translator (JCGO)
The JCGO translator (which is, in other words, a "retargetable" optimizing Java-source-to-C static whole-program compiler) transforms the Java source files of your application, the source files of all Java libraries used by your application, ...
Starred by 83 users
Forked by 21 users
Languages   Java 88.9% | C 10.8% | Java 88.9% | C 10.8%
🌐
GitHub
github.com › raphaelcohn › java2c
GitHub - raphaelcohn/java2c: This project is unmaintained and unfinished.
A transpiler to convert Java to C source.
Starred by 56 users
Forked by 14 users
Languages   Java 84.7% | Shell 7.7% | C 7.4% | C++ 0.2% | Java 84.7% | Shell 7.7% | C 7.4% | C++ 0.2%
🌐
GitHub
github.com › shreyash14s › Translator
GitHub - shreyash14s/Translator: A Simple Java to C++ translator
A Simple Java to C++ translator. Contribute to shreyash14s/Translator development by creating an account on GitHub.
Starred by 3 users
Forked by 3 users
Languages   Yacc 73.1% | Java 16.3% | Lex 8.6% | Makefile 2.0% | Yacc 73.1% | Java 16.3% | Lex 8.6% | Makefile 2.0%
🌐
GitHub
github.com › mesut146 › java2cpp
GitHub - mesut146/java2cpp: java to c++ converter as command line software
java to c++ converter as command line software. Contribute to mesut146/java2cpp development by creating an account on GitHub.
Starred by 4 users
Forked by 2 users
Languages   C++ 56.7% | Java 43.2% | C++ 56.7% | Java 43.2%
Top answer
1 of 4
2
  • Firstly, when it comes to conversion from language 'X' to language 'Y', then no program can beat human intentions/efforts.

  • For the above case Java to C++ conversion can be done using programs such as TanglibleSoftware. But for some language constructs which are only supported in Java but not in C++, some work around is surely needed.

  • Consider case: User 'A' hands over his source code to program 'ABCD' for conversion from language 'X' to 'Y', and he assumes to get the result(exact converted code with same behavior) in bare minimal efforts, then user 'A' is calling for a failure.

  • I will not go into syntactic differences between Java & C++, but if one has a good grasp on programming then for unsupported constructs of language 'X', code can always be written to perform those operations in language 'Y' successfully.

Machines can only understand code, but meaning has to be construed by Humans.

But this may not be constrained if we consider artificial intelligence into this context or some 'xyz' technology in near future.

My answer is based on my experience, I am not affiliated to TanglibleSoftware by any means, the above software worked for me, with some efforts made. It might not have worked for some other users.

2 of 4
0

Something like this is not really posible, since there is concepts and keywords in Java without equivalents in C++. For example synchronized, package or instanceof can´t be translated from Java to C++. Even final has not always the same meaning as const.

🌐
GitHub
github.com › justiceo › JavaSharp
GitHub - justiceo/JavaSharp: A simple Java to CSharp (C#) converter (transpiler) · GitHub
This tool would transpile a Java source code to valid C#. Uses JavaParser(include link) to get the AST and then re-writes the syntax via a visitor.
Author   justiceo
🌐
GitHub
github.com › danfickle › cpp-to-java-source-converter
GitHub - danfickle/cpp-to-java-source-converter: A translator to convert C++ to Java. A work in progess. · GitHub
A translator to convert C++ to Java. A work in progess. - danfickle/cpp-to-java-source-converter
Starred by 51 users
Forked by 33 users
Languages   Java 94.0% | C++ 6.0%
Find elsewhere
🌐
GitHub
github.com › badlogic › jack
GitHub - badlogic/jack: Java to C transpiler, ignores memory model and other stuff, uses Boehm GC for extra slowness and GC pauses
Java to C transpiler, ignores memory model and other stuff, uses Boehm GC for extra slowness and GC pauses - badlogic/jack
Starred by 64 users
Forked by 5 users
Languages   Java 44.3% | C 39.7% | C++ 16.0% | Java 44.3% | C 39.7% | C++ 16.0%
🌐
GitHub
github.com › HanSolo › converter
GitHub - HanSolo/converter: A Java based unit converter
Converter temperatureConverter = new Converter(TEMPERATURE, CELSIUS); // Type Temperature with BaseUnit Celsius double celsius = 32.0; double fahrenheit = temperatureConverter.convert(celsius, FAHRENHEIT); double kelvin = temperatureConverter.convert(celsius, KELVIN); System.out.println(celsius + "°C => " + fahrenheit + "°F => " + kelvin + "°K"); Converter lengthConverter = new Converter(LENGTH, METER); // Type Length with BaseUnit Meter double meter = 1.0; double inches = lengthConverter.convert(meter, INCHES); double nanometer = lengthConverter.convert(inches, NANOMETER); System.out.println(meter + " " + lengthConverter.getUnitShort() + " => " + inches + " in => " + nanometer + " nm"); // Convert meter to centimeter System.out.println(lengthConverter.convertToString(meter, CENTIMETER));
Starred by 41 users
Forked by 11 users
Languages   Java 100.0% | Java 100.0%
🌐
GitHub
github.com › topics › code-converter
code-converter · GitHub Topics · GitHub
java c-sharp code-generator code-analysis code-transformation code-parser code-converter java-to-csharp
🌐
GitHub
github.com › arnetheduck › j2c › blob › master › README.md
j2c/README.md at master · arnetheduck/j2c
J2C will convert Java code into hopefully compilable C++(11) code. It works on source level, translating Java source code constructs into their rough equivalents in C++ .
Author   arnetheduck
🌐
GitHub
github.com › yeej2 › Java-to-C-Translator
GitHub - yeej2/Java-to-C-Translator
Compile with javac run with java Translate Then enter in java or CPP file name and it will translate it to the other language
Author   yeej2
🌐
GitHub
github.com › topics › converter
converter · GitHub Topics · GitHub
All 7,593 Python 1,859 JavaScript 1,198 HTML 629 TypeScript 537 C# 499 Java 442 Go 324 C++ 274 PHP 245 C 191 ... A professional video compression tool accessible to all, mostly based on FFmpeg. ... JODConverter automates document conversions using LibreOffice or Apache OpenOffice. ... audio java converter video cross-platform decoder reverse-engineering media playstation psx video-converter tim file-formats
🌐
Mtsystems
mtsystems.com
mtSystems - C Source Code to Java Source Code Translation
We cannot provide a description for this page right now
🌐
GitHub
github.com › liwei606 › c2java
GitHub - nausicaalii/c2java: A translator of c to java.
A translator of c to java. Contribute to nausicaalii/c2java development by creating an account on GitHub.
Starred by 19 users
Forked by 6 users
Languages   C 40.5% | Makefile 20.7% | Shell 19.6% | TeX 8.2% | M4 5.5% | C++ 2.2% | C 40.5% | Makefile 20.7% | Shell 19.6% | TeX 8.2% | M4 5.5% | C++ 2.2%
🌐
GitHub
github.com › bytedeco › javacpp
GitHub - bytedeco/javacpp: The missing bridge between Java and native C++ · GitHub
The missing bridge between Java and native C++. Contribute to bytedeco/javacpp development by creating an account on GitHub.
Starred by 4.7K users
Forked by 596 users
Languages   Java