Flexible - converts snippets, files, and folders from Java to C++
Fast - tens of thousands of lines converted from Java to C++ per minute
Helpful conversion comments
Excellent educational tool for Java developers learning C++
Numerous conversion and formatting options
10 Second Overview
Java to C++ Collections Conversion:
Java to C++ Arrays to Vectors:
Java to C++ Anonymous Inner Class:
Java to C++ Generics:
Java to C++ Optional Type:
*Scroll right to see Java to C++ Converter screenshots
Q: Are entire folders converted?
You can select Java folders to convert.
All ".java" files within that folder will be converted and
output as either traditional .h/.cpp files or C++20 modules
to the directory you specify. However, Java to C++ Converter does not construct
the new C++ project file. This is due to the lack of one-to-one correspondence
between Java project types and formats and C++ project types and formats.
Q: Are the original Java files altered in any way?
Your existing code is left completely intact. The new
C++ files are output to the new location that you specify.
Q: What is the conversion accuracy?
Our accuracy is very high,
but there will be significant adjustments required for all but the simplest
conversions. There are no direct equivalents for some aspects of Java.
Read the rest of the FAQ to get an idea of a few things that are not converted.
Java to C++ Converter is intended to reduce the amount of work you'll have to do
to convert code to C++, but it is just the first step.
Q: How are anonymous inner classes handled?
Anonymous inner classes are converted to C++ nested private classes, but if the
interface is a functional interface, then the interface is converted to a function pointer typedef
and the anonymous inner class is converted to a lambda.
Q: Are Java functional interfaces converted?
Yes - try out our Free Edition to see the conversion details. We
optionally convert Java functional interfaces to C++ function pointers.
Q: What about Java UI code?
The converter does not convert Java UI types due to
the lack of correspondence between these types and C++ UI types.
Q: What are the most common manual adjustments?
Java to C++ Converter converts
only some Java library types to C++ equivalents. The converter offers
options to use your own custom replacements.
Java to C++ Converter cannot ensure proper deallocation of pointer variables. In some
cases, a call to the delete operator is made, but in general
complete memory deallocation is not included in the conversion.
However, the converter contains options for converting to smart pointers.
Java's event handling model has no direct equivalent in C++.
Java wildcard generics have no equivalent in C++, unless used in a method declaration parameter list.
Java local classes cannot be declared within methods in C++. These are marked
with a comment.
There will be occasional qualifier symbol
adjustments required. For example, it is possible that
Java to C++ Converter fails to determine whether a particular Java dot
operator should be replaced by a C++ arrow, double colon, or
dot. If type analysis fails to determine the equivalent,
heuristics are used to determine the most probable equivalent.
There is no acceptable equivalent to an exception 'finally' clause.
Java local final variables have no exact equivalent in C++. These are
converted to constexpr, which requires that the assigned value be a compile-time
constant. For cases where the assigned value is not a compile-time constant,
you will have to remove the constexpr qualifier.
Since Java to C++ Converter does not map to a
particular C++ project type, the Java 'main' method is left in
it's original location and converted literally. Depending
on the C++ project type, you will need to adjust the location
and structure of the main method.