Results 1 to 11 of 11
Thread: jvm
- 01-13-2011, 03:47 PM #1
Member
- Join Date
- Sep 2010
- Posts
- 18
- Rep Power
- 0
- 01-13-2011, 04:38 PM #2
Because java is platform independent, not the java interpreter. Besides, if the interpreter were written in java how would you run it?
The concept is this. The VM is a native app, but behaves the same way on each platform (its supposed to anyway). The code that is actually run by the VM is the same all over. It has no knowledge of the platform its running on, it is abstracted from hardware by the VM.
Also, just because something is written in C doesn't mean it ISN'T cross platform. A pure C app that doesn't use native libraries can run on any platform that has the same architecture (CISC vs PPC).
Java code is truly portable in the sense that as long as your platform has an interpreter (JVM), you can run java code. The same cannot be said for most C, C++, ObjC, etc apps because they link to native libraries to perform operations making them platform and architecture dependent. Java has no architecture dependencies.
- 01-14-2011, 03:50 PM #3
Member
- Join Date
- Sep 2010
- Posts
- 18
- Rep Power
- 0
so a jvm interpreter can nvr be written in java?? if no, why not?
-
I don't know that there is anything in the JVM specification (again as far as I know) that specifies what it can or can't be written in. If the JVM is running on a Java machine (and I've heard that these have existed in the past), then I imagine that the JVM could be written in Java. For all practical purposes though, for 99.999% of machines that run on Windows, Unix, Mac and other OS's, then there's no way that a 100% Java application can communicate fully with the OS.
- 01-14-2011, 04:06 PM #5
Member
- Join Date
- Sep 2010
- Posts
- 18
- Rep Power
- 0
thnx a lot :)
- 01-14-2011, 05:53 PM #6
But also, if the jvm was written in java, and there was not another non java jvm running on the host, the how would the jvm even execute? a jvm is required to execute java statements, so a java jvm would require another jvm to run on top of. Java the language is completely virtual existing only in the context of the virtual machine it runs in, it cannot be executed directly by hardware as it is not machine code but byte code. The jvm is the interface between java and hardware, so if it was written in java itself, what would serve as it's interface?
-
@quad: yep you're right of course. In my misguided post, if a chip implemented the JVM, there would be no need for a JVM in software.
- 01-14-2011, 08:00 PM #8
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
- 01-14-2011, 08:09 PM #9
Remember Project looking glass? But both of those ran on a Hypervisor - which acted as the JVM. Just like BluRay.
-
- 01-14-2011, 08:11 PM #11


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks