How Translate ByteCode to Machine Native Code [closed]
Asked Answered
I

3

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!

Into answered 17/11, 2011 at 12:57 Comment(10)
Have you looks at GCJ (GCC Java compiler?)Robbinrobbins
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 - excelsior-usa.com/jet.htmlSpeculation
Just to give you a keyword to search for: you're looking for an AOT (ahead of time) compiler.Bik
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.Steed
This is a duplicate, but only if you've heard of AOT before (I hadn't).Steed
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.Norris
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.Eberhard
#4036038 || #5870165Waldman
Do you have speed issues with your code?Bladdernut
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. @RobbinrobbinsGraycegrayheaded
C
1

There are multiple solutions. All are not ideal.

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

Courage answered 17/11, 2011 at 13:3 Comment(1)
I don't think exe4j is an AOT - it doesn't precompile to native code, AFAICT.Steed
B
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.

Briefs answered 30/12, 2013 at 23:12 Comment(0)
C
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).

Chari answered 15/8, 2020 at 9:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.