Can you program an os in java with a kernel and bootloader written in assembly or c++ or something?

Why would you?
You need low level access to Input / Output ports, chip system only instructions, etc. High level languages do not do everything the assembly instructions do! In fact High level lanaguages are built upon a near majority, but not all of the processors instruction set!

On that posting!

"However, we do have around some assembly code. Like a kernel written in C, our C# kernel needs assembly code to handle the lowest part of the interrupt dispatch on the x86. But once the assembly code has finished, it dispatches directly into compiled C# (no C). BTW, there is some C code in the system, primarily for the debugger stub."

Usually when a C program is compiled into an executable
access to the file system and console I/O is performed
through the underlying operating system's API
using executable instructions intended for execution
on a particular architecture (like x86-32).
The executable format will be dependent upon the OS
involved as well, including any initialization routine
which the compiler includes with the executable.
Thus, a differ from the norm may be required when compiling
C programs for a custom OS.
It is completely possible to use inline assembly to call
your custom OS's API.
The study of operating systems is quite educational,
but an understanding of the architecture on which
they are based is a must.

Oh yeah,
and some kernels are written partly in assembly and
partly in a high level language.
Linux was written in C and uses assembly language
where needed.
There are projects for kernels
written in ADA and C++.
Writing a kernel completely in assembly makes it
harder to port the kernel to another architecture.
This is one of few reasons for this consideration.
But yes, you do need assembly for low-level
access to the system registers,interrupts,
memory locations,etc...

This article has been dead for over six months. Start a new discussion instead.