开发者

convert C source to Java source? preferably for windows

i'm looking for something that'd convert C source code into java source code.

Preferably I shouldn't have to have any C or java compiler or JVM on my system, I just want to run the program.. give it a C file, and have it converted to java source code.

Preferably the code should 开发者_运维百科function the same!! But I at least want the tool to make an attempt!

Here are the errors from c2j http://img17.imageshack.us/img17/1593/aavp.jpg


It's going to be challenging to convert a C program into Java automatically. The differences between C and Java means that you can't just convert line by line. A few example:

  • C does not support classes, but classes are a fundamental concept of Java.
  • C has a huge pointer syntax, Java doesn't.

There are many, many differences between C and Java, so I doubt that any program will do a good job of the conversion.

That said, there are a few project thats attempt this:

http://www.soften.ktu.lt/~stonis/c2java/

http://tech.novosoft-us.com/product_c2j.jsp


If you want to run it as Java you will have to have a JVM!

As for translation, try looking at NestedVM.

EDIT: Your title says one thing, your question asks the opposite. This answers the question C → Java question you originally asked.


I've not tried it but here is a link to a tool that claims to do what you want.


If you don't need to run it, but just read and understand it, you'd better ask a C developer to explain you... Automatic tools will always produce badly written code and hard to read.

As suggested in the comments, if the code is small, you can also post it here so we can help you understand.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜