I recently read that java was made so it can run about anywhere, like for example on a toaster. So this question popped in mind, can you run Java Virtual Machine and java programs on a fresh computer/laptop that has no operating system like from a disk or a USB ? If so, could a java program written on my windows run on the JVM on the No OS computer too ?
I tried searching on google, but i could not find anything related
Thanks
Since the JVM is interoperable across operating systems, this is no mean task. In addition to each application's resource needs, the execution engine must be responsive to each OS environment.
You are correct that the JVM differs between operating systems while the byte code generated from compiling a Java program is the same no matter which OS you compile it on. However, the JVM is NOT part of the OS. In otherwords, when you install Windows, for instance, the JVM is NOT automatically installed.
A JVM by itself would do no good -- without the java. lang. Object class, the JVM isn't going to run any code!!! You need at least the JRE, which is the JVM plus standard classes, to run Java programs.
The Java specifications don't require the JVM to run on top of an OS; that's much of the reason behind the careful wording in the specs. BEA's Project Bare Metal was a JVM effort to run directly on hardware without an operating system, and OSv is a developing a JVM that will run on a hypervisor but without the need for a traditional OS.
Additionally, embedded Java implementations, such as in smart cards, generally don't use a runtime JVM. Instead, the JVM is an ahead-of-time compiler that translates bytecode into machine code for the target platform.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With