Sun was actually a decent company once upon a time. Their problem was that Microsoft excluded them from the market and starved them for money for so long that their hardware stopped being competitive, so that by the time Java made it so you could run some software on it, nobody wanted their hardware regardless.
It was only after they went bankrupt and got bought by Oracle that things like OpenSolaris getting killed off and Java lawsuits started happening.
> "Their problem was that Microsoft excluded them from the market and starved them for money..."
That is not what happened. Sun Microsystems had immense revenue and clout in the server and enterprise space because of the dotcom boom, so much so that their advertising declared "We're the dot in dotcom." Microsoft was trying to duke it out with them in the server space but Windows Server was just barely starting to become decent at that point so MS didn't get all that much traction.
When the dotcom bust hit, Sun went into a tailspin because of the glut of Sun server hardware from dead dotcoms at bargain basement prices. That eventually passed but by that time Linux + Intel was good enough to undercut both Sun and Microsoft in the server space. With no way to compete with free as in beer software, Sun was doomed.