   Java to C++ - Automatic Migration
  I'm about to begin a project porting a Java (actually J2ME) project to C++. Does anyone know anything about tools to automatically migrate the code between the two languages?Obviously no tool is going to be able to do all of the work but it would certainly help get things going. Also, the original project is still under development and so having a tool would be a good way of tracking a moving codebase.I'd always assumed that tools to do this existed in some form but a couple of hours spent searching the web hasn't produced anything useful. Is this a good tree to be barking up?Thanks for any advice,ResearchMonkey   
  Not aware of any such tools, C++ isn't GCed so there's going to be a fair bit of difference in the code - unless you're planning on using Managed C++. Similarly, Java dosn't have pointers, so there's going to be a fair bit of difference in the code that way too.There may be tools, but I don't know of any. I'd get ready to make ample use of the boost smart pointers library for your RAII needs (http://boost.org/)   ;  I think it's preety impossible.lets say you have a function in java that gets an object, how the program should know if you are passing it by value, by refrence, or by pointer?just a small example of the diffrences.   ;  There might be some tools out there but I am unaware of such. If you know c++ you could just go line by line and change what is needed but I agree using a tool could save you time. Also the tools would probably cost some money because I don't think they would be free/shareware.   ;  What you actually need is a compiler.  It's _entirely_ possible.  However, the resulting code probably is not going to be very nice.. especially because of things like a lacking garbage collector :)A preliminary search turned up this:http://www.edg.com/jfe.htmland http://www.dinkumware.com/jproject.htmlHowever, any tools you may encounter through either of these sites, are probably going to cost "big bucks."You may also want to check out GNU's java compiler (which can compile to native code, yay!).. perhaps there's a backend for it to generate C/C++ code... shrug.However, that brings up an interesting question.  _Why_ are you porting the application in the first place?  Is it purely for speed concerns?  Memory footprint?  Perhaps just using GNU's native code java compiler may provide the same end results, without the change of language.  Just a thought.;  Thanks everyone for your replies, it sounds like this is going to have to be done the hard way =( It seems surprising that noone's tried to do this yet. There are some issues but nothing that seems completely insurmountable. This probably means that I haven't thought about it enough.AP> Thanks for the links, shame that the project is still under development. The reasons for porting are commercial and we also need to have readable C++ source code otherwise a Java->Native compiler would have been a great way to go. Oh well.Thanks again,ResearchMonkey   ;  @Ilankt actually, java transforms the notion of object to suggest pointers. Every object in java is actually a pointer(or may be referred as a pointer) in C(C++ any?).Of course you will need J2me hierarchy implemented in C(let's call it a library) and an underlying framework to handle gc(to say at least, there may be other things as well, I am not fully aware)+ the tool to transform(actually it easy to transform(you can write a program in a few hours), just define a refactorizing technique.But beware the pointers!!   ;  Given a clever program that can convert all your objects to smart pointers, it shouldn't be all that difficult. Asside from that, it's a simple matter of syntax conversion and probably manual conversion for uses of Java's library.One would think that it may be faster, for most projects, to convert by hand. Although it may be benificial to make a program that converts the syntax and then the user could convert library use and object pointers by hand. Of course, you'd have to be proficient in both languages.Interesting Question: Can the GNU Java compiler compile to object files or static libraries that can then be used by the GNU C++ compiler?   ;  If there isn't a program which will convert it all for you (I don't think it's as straightforward as it initially seems) you could sniff the java code in using a modelling tool like Enterprise architect and then generate it as C++.   Obviously this isn't going to do anything with the actual logic but it will give you some classes with member and method declarations.   ;Quote:Original post by Andrew RussellInteresting Question: Can the GNU Java compiler compile to object files or static libraries that can then be used by the GNU C++ compiler?Sure CNI