Page 1 of 1

Convert Java to C?

Posted: Wed May 07, 2014 6:05 pm
by cheezyguy5
I've been reading about running a minecraft server on a Pi, and it seems the main reason it's so slow is that it's running in a Java Variable Runtime Environment. Wouldn't it be possible, at all, to convert the minecraft_server.jar to C code? If so, wouldn't it be able to run directly on the Pi without an emulated environment?

Re: Convert Java to C?

Posted: Wed May 07, 2014 7:45 pm
by tedhale
You would have to de-compile the java source from the jar file, then convert all the java code to C, including replacements for all libraries used. That would be a LOT of work.
But, yes, assuming you did all of that, it would run in native mode and be faster. My guess is that it would only be a little faster.

Re: Convert Java to C?

Posted: Wed May 07, 2014 7:46 pm
by jamesh
Might be worth a search to see if this has already been done.

Re: Convert Java to C?

Posted: Thu May 08, 2014 7:28 am
by ghans
Instead going down that dead end (so far i know Minecraft
is obsfucated via ProGuard or something else) , just try it
with the newest Oracle Java 8 JRE which is available for the Pi
free of cost. It is way faster than OpenJDK and faster than
Oracles Java 7 , too. If that isn't enough , use a desktop
to host your server.


ghans

Re: Convert Java to C?

Posted: Fri May 09, 2014 3:53 pm
by vyalmicro
It isn't that simple. First of all you would need to decompile to get the Java code back first of all. I don't think it would be legally very great idea. Given you successfully decompiled and generated the Java code then it would be almost impossible job to translate Java to C. You'll need to implement the object oriented features of Java in C. Use already existing formal grammar of Java and then use flex/bison to generate a intermediate code. Then translate that intermediate code into C. You'll then have to compile all needed libraries too by your compiler and make sure it works well with your new compiler.
Ready to do so much work to only make Minecraft work at Pi? I doubt it would be too much for what it is worth.