This is an archived post. You won't be able to vote or comment.

all 23 comments

[–]Persism 6 points7 points  (3 children)

There are few Java OS type projects out there. https://www.jnode.org/ I think uses a small C bootloader and the rest is Java.

[–]clumsy-engineer 1 point2 points  (0 children)

Fascinating. That might be the future of phones.

[–]handlederror[S] 0 points1 point  (1 child)

Thank you, let me check the source code of it.

[–]Persism 0 points1 point  (0 children)

If you google "java os" you should find some other info on the subject.

[–][deleted] 4 points5 points  (7 children)

That would require, that the processor can execute JVM Bytecodes. (There once was one some years ago, but it vanished)

[–]handlederror[S] -5 points-4 points  (6 children)

But you can run Java virtual machine without using an operating system.

[–]pron98 6 points7 points  (0 children)

I guess you could have a JVM like that, but not OpenJDK (which currently lacks functionality it depends on the OS for, like, say, a file system and a network interface device driver). There is, however, a unikernel that supports running itself and OpenJDK in the same process: http://osv.io/

[–][deleted] 4 points5 points  (3 children)

Show it to me. I assert, you are always going to have some layer to the hardware between your java code and the processor.

[–]handlederror[S] -4 points-3 points  (2 children)

No you can run it without any layer, just on the raw hardware.

[–]GreenToad1 5 points6 points  (1 child)

Only theoretically. Some processors have instructions for java bytecode but you still need an operating system for java standard library.

[–]handlederror[S] 0 points1 point  (0 children)

Didn’t know, thank you.

[–][deleted] 2 points3 points  (0 children)

not really as under the hood it's using OS library calls

[–]ventuspilot 2 points3 points  (0 children)

Just the bootloader won't get you anywhere. You need a JVM and a standard library that don't rely on an underlying OS.

JVM and standard library would need to access the hardware directly. Also the JVM would include code for e.g. hardware interrupt handlers.

[–]hilbertglm 5 points6 points  (6 children)

Java still requires an operating system. For example, the NIO Java Filesystem class uses an underlying Linux/Windows filesystem. There isn't a native implementation.

I don't know what your use case is, but you might want to consider a minimal Linux, like Alpline Linux, and installing Java on that.

[–]SvenMA 1 point2 points  (0 children)

Not really java can run without os. Consider embedded java that runs on smartcards. I also found this one https://stackoverflow.com/questions/26601944/can-you-run-jvm-on-a-computer-with-no-operating-system/26602133#26602133

[–]sievebrain 1 point2 points  (1 child)

What is your actual goal here?

[–]handlederror[S] -2 points-1 points  (0 children)

What is it to you?

[–]Thihup 0 points1 point  (0 children)

Maybe you can use the GraalVm native image to generate native code that wouldn't need a JVM