Are you talking about Java as in PC's?
From what I see many people coding micro these days are more computer programmers than electronics engineers. Stop anyone in the street and ask them what they think electronics is and they will basically start talking about computers. Dave did a drive time rant on this many years ago where he said that he ends up not challenging people who make the assumption he designs computers because it's just too much effort to explain.
When we talk about PC's we assume an x86 standard platform, so if you have an OS you love chances are it will work on any x86 or derivative, this is a given to the point that many probably do not understand the level of standardization. Companies who might be at each others throats in advertising are actually working together in the background to make sure that their products are compatible so that they can both be picked for your OS of choice.
Then we come to operating systems. Now I am well aware that there are many programs that work on multiple operating systems. So clearly whatever high level language they use, this is supported on any OS used and the same code will produce the same result, because obviously the whole world does not do the same work 2 or 3 times over just to get the same results. There will of course be a massive amount of work done by someone else to ensure the same resources are available in each OS and that they appear the same so that the code can simply be recompiled.
But everything I have outlined above has one thing in common, the hardware!!!!! a motherboard from asus will function just as well as one from msi because they both use components that adhere to a standard. Micro controllers are hardware, and they are not standard!!! The closest we have to standardization is that we all use C and C++ and well there are others of course. I learnt C not because I felt it was what I needed but because everyone else uses it and if I wanted help asking for help in some obscure implementation of basic would probably not get me anywhere. the peripherals are different on any MCU, even MCU's of the same brand will have wildly different procedures for setting them up and features.
I use the SAMC, it has 2 types of counter on the one chip! I can't even write standard code that will work on both types of counters on the same chip!!!. Well I could, but I would have to strip the functionality of the more complicated one down to that of the simpler one. Where do I stop? a TC has 2 PWM outputs, a TCC has 4 PWM outputs and can have a second set of 4 PWM outputs that are delayed relative to the main 4 so that you can do dead times for things like push-pull outputs.
So do I write my standard code so that any counter is treated the same? well if I did that I would reduce a TCC down to about 1/4 of it's functionality just for something that is one of the functions the counters can do. In my current project I am actually running out of counters. If I did this I would actually have run out and have to get a bigger chip. So instead of the SAMC21J with 64 pins I would get a SAMC21N with 100 pins, oh but on this chip although you have more counters these extra ones share the interrupts of the already existing ones, this now complicates the code and actually slightly slows things down potentially, not to mention the cost.
What I am saying is that there is no free lunch. A micro controller that is not running an operating system but being used as a real time device is an electronic component, it is an ASIC without the need to pay the cost of actually getting an ASIC made, why are we trying to use them as computers and expect the same panacea of compatibility from sub 1$ devices that we have from at the least, a $50 SBC which can still be a bit of an ask or a PC that costs several hundred dollars?