As someone who has worked with both Java and C#, I would say while Java might have been "good enough" it's lacking when compared to C# across the board. Microsoft has consistently improved the language ahead of Java, with new technology like generics (or properties, but you could argue about that one). Also, the development environment for C# is much better than whatever you can cobble together for Java. I think much…
So Sun's JNI and applet web browser integration languished while Microsoft integrated COM and CLR for seamless interoperability with the web browser and other languages like C++ into Java and CLR.
Sun also had an unholy obsession with code generation, since their attitude was to breed as much 100% Pure Java Code into the world as possible (see AspectJ, JAXB, etc). While C# took a much better approach of supporting code annotation and metadata and reflection and bytecode generation at runtime so you didn't actually have to generate and compile a huge pile of boilerplate source code (see PInvoke).
https://docs.microsoft.com/en-us/cpp/dotnet/how-to-call-nati...