Search code examples
javaframeworks

What and How Java framework be built?


I know this question is a bit silly.

I am a Java Programmer that never look into Java source code before, I have been using Java (official) framework (for example like javax.swing., java.util., java.collection.* and blah blah) to build some app.

Now I try to look into the Java source code (I am the victim of black-box programming paradigm) and found that the source code is totally written in Java. Now, I am confused that, what is the framework that is being used by Java (the one that in Java source code, I know a bit confused here) to form the framework that we are using so much?

Sincerely I expected to see some assembly-kind of code in Java source but in fact it is not. I 'feel' that the normal framework (java.., javax..) that we use are not the lowest entry point to the JVM. There must be something 'lower' than that.

Anyone can explain about this?


Solution

  • Most of the Java library (what you call the Framework) is written in Java. The JVM that interprets the compiled bytecode is implemented in C++ for the most part, and the library does contain "native" methods written in a lower-level language (C or C++).

    Methods are written in a lower-level language for only two reasons: platform dependencies (things that have to be different on each platform), and performance (things that get used all the time and benefit from being native code).

    The end result is that almost all of the library is platform-agnostic and doesn't have to be rewritten for each platform. The scope of non-Java code is limited to only the stuff that HAS to be platform specific.