Java is a general-purpose concurrent class-based object-oriented
programming language, specifically designed to have as few
implementation dependencies as possible. Java allows application
developers to write a program once and then be able to run it
everywhere on the Internet.
</quote>
Oops, I'm getting my language histories mixed up.
Java was designed to be portable, but for embedded systems. When it didn't
have the success there that the developers wanted, they targeted the
Internet.
It was similar to the .NET Compact Framework, which is fairly portable on a
few different embedded systems.
Almost all of the class library is written in Java, and there's one
common code-base for Sun's VM across platforms. Sure, some parts of it
will be platform-dependent (such as the native parts of the preferences
API implementation)
I had a professor say once that since Java has no fast/easy way to call the
underlying OS directly (such as .NET's P/Invoke), that all platform
independance was accomplished through writing parts of the library in C and
using a special interface (Java Native Interface). It made sense, so I
belived him.
On the other hand, Mono or DotGNU can use different implementations of the
same class written with different P/Invoke bindings.
I'm not sure which is better---leveraging the existance of C compilers for a
wide variety of platforms, or keeping all of your code (mostly) in one
language.
I know that in Mono they keep the amount of external native code to a
minimum.
From:
http://www.nag.com/local/techtips/cfromjava2.asp
"After the native shareable library is built, Java code that uses it is
still machine-independent even though the native library is not. Thus, you
must build the library on all platforms the Java program runs on, although
you don't need to edit or rebuild the Java code."
Do you have any figures on what portion of the Java Library is implemented
in Java and what is in C?
I'm not sure where this comment comes in... was it for the "what's the
point of .NET otherwise"? If so, I agree that there are for more
reasons to use .NET than just portability.
Yes, I was responding to the original question about the need for a virtual
machine.
True, although as far as I'm aware .NET isn't available for the Alpha
version of NT.
Right, and I don't think there are plans to, either. I was just mentioning
that Windows NT itself is not platform-dependent. It is in fact VERY
portable.
It's the programs that run on it that aren't.