Link to home
Start Free TrialLog in
Avatar of rainmal
rainmal

asked on

C++ to Java Program Converter ???

hello,
copying this at both C++ & Java forums.

We have got a Application written in C++(for WinX) and need to convert to Java.

As far as i can see the code is straightforward and a good translator would be helpful.

Are there are commercial ,freeware ,shareware stuff available which is a little over the alpha stage? I mean uh is it reliable?

Please give URL's or mail me at rainmal@engineer.com
Will give additional points to anybody who gives pointers to links,particularly converting Linked lists/Binary trees to Java

Thanks
Avatar of mbormann
mbormann

I am also interested ,if u find out anything please let me know too.
listening ...
Most of the links are repeating Talingent's site ,I think that you will have to do it manually.
See
Erich's Java cheat sheet for C++ programmers
http://www.math.ncsu.edu/~kaltofen/courses/Languages/JavaExamples/cpp_vs_java/

Moving from C++ to Java
http://www.pvv.org/~ingvalds/eige/txts/java.html

After seeing and browsing I am convinced that there was a C2Java convertor available a few years ago in 1996 to be precise ,it was then taken off the market by Morgan Stanley ??? for reasons best known to them.

http://meurrens.ml.org/ip-Links/Java/joodcs/ilya-c2jGNU-readme.txt
http://www.objdev.org/news/odg9612.txt
Avatar of rainmal

ASKER

I think that we will have to do it manually.
Any more links to those above?
I am disappointed that not many people are coming forward to comment on this,but just 'listening'.

pls give inputs.
Thanks
With some reservations, have a look at R2J, which is a C++ to java converter capable of handling GUIs:

http://www.scicontrols.com/R2J/R2J.html

It has a downloadable demo here, so you can try it out.

I say with some reservations because personally I would not trust trying to reverse engineer a C++ project into Java directly.

What might be more appropriate (and trustworthy) would be to reverse engineer your basic code structure into a CASE tool which can then show you how it has interpreted the code and allow you to make some sense of it.

You can then re-export the basic code structure into class files and packages then change the details of complex code manually. But at least this way you will have a fully documented CASE analysis of your code and will have an t=interediate stage in the conversion to allow you to ensure that the conversion is progressing OK.
meant to say:

But at least this way you will have a fully documented CASE analysis of your code and will also have an intermediate stage in the conversion to allow you to ensure that the conversion is progressing OK.

curse this keyboard that doth misinterpret what I type...
Avatar of rainmal

ASKER

Jod,
We already did that in Rational Rose and Imagix but i canna understand it at all.

mbormann, is  this true?

Also please check out
http://sol.pace.edu/~tilevich/c2j.html

will keep it open for a few more days and then close it guys
Thanks
Rational Rose should be able to produce a set of design diagrams in UML format for example that will map directly to your clsaa heirarchy. This is information that you can relaibly convert between C++ to Java - anything else is a bonus...
R2J converts *windows resource files* into Java classes, it does not deal with C++ code.
C2J++ is a toy, as it cannot even deal with automatic variables.

I say an automatic C++ to Java translation is not feasible.

You could look for a C++ to JVM bytecode compiler...
also check:
http://www.deja.com/viewthread.xp?search=thread&recnum=%3c7s52u4$7sc$1@nnrp1.deja.com%3e%231/1&AN=527487256&svcclass=dnserver&frpage=getdoc.xp

People imply that a translator for the full spec of C++ to Java is not feasible and even a compiler of C++ to JVM is problematic. (I don't know about the Java founding fathers but on the C++ side, Stroustrup and several other ISO C++ committee members participated in that discussion).
Avatar of rainmal

ASKER

Hello everybody,
The C++ community i think responded more to this than anyone over here ,I don't know why they stayed out

it's time to close it and move it to the PAQ list i think,
the background is that the C++ app does not use STL,templates and multiple inheritance is used rarely ,just 4/5 instances and the thing is that Java design of our existing product into which it is going to be integrated is far simpler than the C++ one.
That's all I can say for now ,

mbormann ,lock this
as per the discussion there at C++ we will require manul tips ,anything else comes by please provide it as a comment even after it's a PAQ ,this is a request for everybody who participated OR who just 'listen'.

And Jod you too provided strong contribution here ,you hit it on the nail on the head abt the CASE tools ,i am providing a dummy question for you

Malory
Avatar of rainmal

ASKER

jod ,
please lock the question titled
'for Conversion gurus'

Thanks
ASKER CERTIFIED SOLUTION
Avatar of mbormann
mbormann

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As I said earlier and as Alexo would seem to suggest as well, an automatic converion is not really feasible. The biggest mistaken assumption that can be made is that Java is C++ with only a few changes.

Though there are many similarities in the syntax of C++ and Java, there are huge differences in the way Java actually manages objects and the semantic structure of the language.

The key issue can then become how you go about picking through the code to ensure it is converted correctly and identifying how you can optimise it. This could take more time than just re-writing it!

Anyway, I digress.

If you decide to use a CASE tool it should give you an intermediate stage at which you can take control of the conversion and ensure it is making sense. The pleasing side effect of this is that it will provide an extensive documentation of your code as well for free. Can't be bad...

Good luck...
Avatar of rainmal

ASKER

Jod,
thanks for your input again i say this if you find anything relevant please leave it here

Malory
See if this helps,
'Moving C and C++ Code to Java'
www.itlibrary.com/reference/library/1575211025/ch28.htm
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
https://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange