Jump to content
  • Advertisement
Sign in to follow this  
slackey

Java, bytecode, and exe's

This topic is 4709 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Today in computer science, my teacher asked if Java ever creates an executable file. I said no, because the Java compiler compiles the source into a .class file containing bytecode. She said that's true, but when the bytecode runs on the JVM, it creates an exe in memory. I don't think she's right, but I don't know exactly how the JVM works. I thought that it compiled and executed the bytecode on the fly, rather than all at once and storing the result in memory to execute. On large programs, that would seem rather unweildy. Does anyone know the real answer?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
you are right.

Share this post


Link to post
Share on other sites
Well... yes and no. It creates compiled code from the bytecode on the fly, but leaves that on-the-fly-created compiled code in memory as it finishes each piece (so it won't have to recompile for the next call of the same function). Over time, the entire program can be compiled. :)

Share this post


Link to post
Share on other sites
I would say that an "executable file" is more than compiled code... it includes stuff like imports from dll's, different sections such as code, constants, resources, etc...

Also, when I hear "exe" I usually assume its referring to a windows exe, which is a specific format for storing a binary executable. I'm pretty sure the java virtual machine doesn't generate all the headers and such exe's have.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!