Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you run JVM on a computer with no operating system? [duplicate]

Tags:

java

jvm

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

like image 832
user2578273 Avatar asked Oct 28 '14 06:10

user2578273


People also ask

Is JVM available for all operating system?

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.

Is JVM installed automatically with OS?

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.

Can we install JVM alone?

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.


1 Answers

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.

like image 169
chrylis -cautiouslyoptimistic- Avatar answered Oct 20 '22 12:10

chrylis -cautiouslyoptimistic-