10

I am looking for a translator for translate Java ByteCode to Machine Native Code before execution to improve performance.

I heard that OpenOffice is made with JAVA, but I can't see any jar file in his installation folder, therefore, maybe there is a translator but I can't find it.

Does anyone know some tool or comercial product to do that?

Thanks!

Ed Staub
  • 15,480
  • 3
  • 61
  • 91
Jesús Galindo
  • 471
  • 1
  • 5
  • 11
  • Have you looks at GCJ (GCC Java compiler?) – Mat Nov 17 '11 at 12:59
  • 2
    The JVM itself contains a JIT compiler that will translate bytecode to machine code when needed, but the tools in the market usually just wrap the JVM inside an executable file, just like ExcelsiorJET - http://www.excelsior-usa.com/jet.html – Maurício Linhares Nov 17 '11 at 13:00
  • 5
    Just to give you a keyword to search for: you're looking for an AOT (ahead of time) compiler. – Polynomial Nov 17 '11 at 13:01
  • There are many reasons you might not see a jar - a custom classloader can read any format it pleases. So I wouldn't be too hopeful about the OpenOffice lead. – Ed Staub Nov 17 '11 at 13:07
  • [This](http://stackoverflow.com/questions/4019724/free-aot-java-compiler) is a duplicate, but only if you've heard of AOT before (I hadn't). – Ed Staub Nov 17 '11 at 13:13
  • 1
    Not only the JVM compiles bytecode to machine code during runtime, but it does quite well. I would recommend you to use one of the performance analyzer tools, for example there is one in Netbeans, to determine the critical section of your code, and try to improve that yourself. If you can't, then post your specific performance problem as a question. AOT compiled code will likely be slower, except maybe if you are only interested in better startup time. – Hontvári Levente Nov 17 '11 at 14:02
  • Pre-compiling to native code will improve start up times. However, it cannot make use of the dynamic optimisation the JIT does. i.e. it optimises the code based on how it is used, so I would expect the code to be slower than a warmed up JVM. – Peter Lawrey Nov 17 '11 at 14:17
  • http://stackoverflow.com/questions/4035538/is-gnus-java-compiler-gcj-dead || http://stackoverflow.com/questions/5869665/how-to-create-native-binaries-for-your-java-app – Ciro Santilli OurBigBook.com Aug 03 '15 at 21:36
  • Do you have speed issues with your code? – NomadMaker Aug 15 '20 at 09:20
  • GCJ was never a viable option, due to its radical incompleteness, even to Java 1.2 level, and was discontinued quite a few years ago. @Mat – user207421 Aug 16 '20 at 03:50

3 Answers3

1

Give a look to Avian JVM. See my reply here to this question for pointers on how to embed it and what class libraries you can use to generate your stand-alone executable.

if you just need a managed language/platform, you can also use .NET/Mono AOT. See the mkbundle tool included with Mono 2.x.

Community
  • 1
  • 1
duncan
  • 6,113
  • 3
  • 29
  • 24
1

There are multiple solutions. All are not ideal.

Take a look here (exe4j). To learn more read this article.

AlexR
  • 114,158
  • 16
  • 130
  • 208
0

Please have a look into https://www.graalvm.org/. It could build a native image from your jar and run it as binary (native code).

Traycho Ivanov
  • 2,887
  • 14
  • 24