hasfo.blogg.se

How is compiling java different from compiling c
How is compiling java different from compiling c




how is compiling java different from compiling c

There's a "low level" aspect of C++ that cannot be overlooked, when talking about portability.Īll the answers starting with "The difference is.", or anything very similar, are basically wrong (sorry, but such is life). However, C++ is widely used in critical systems like compilers, kernels, real-time systems,embedded systems. The community has found that by porting the compiler as well as some core libraries of the language, source codes (and not binaries) could be portable. On the other hand, porting the compiler can sometimes be enough.

HOW IS COMPILING JAVA DIFFERENT FROM COMPILING C PORTABLE

So c++ executables will never be portable (unlike Java). On the one hand, it's a compiled language, and those binaries are almost always platform specific. For instance, Java has a package called JNI that allows sending native calls, bypassing the JRE, thus preventing the perfect seamless portability, what Java fans like to call "Write once run everywhere".Īs mentioned in the comments, C++'s approach to portability is different. I won't go as far as calling portability a "myth", but it's true that it's not so perfect. However, reality is not always pretty like this.

how is compiling java different from compiling c

In that sense, the JRE forms an abstraction layer, completely hiding the machine, allowing easy porting. The point is not how or who ports the JRE, but the fact that once it is ported, every Java application should now theoretically run easily on the new machine. Funny anecdote, Steve Jobs made a big deal about not wanting to take care of the porting of Java on Mac, around a year ago. Among other things, it depends on the licensed it's published under (I hear Java is Open Source, so I guess anyone could do it). A lot of factors may come into play when deciding who and how the JRE would be ported. This task is generally done by the core maintainer/developers of the program and/or the platform. Porting the JRE to a new platform is something you need doing only once. "writing a specific JRE for each platform" is not something you do everytime.






How is compiling java different from compiling c