Marketing. Java was The Next Big thing and they wanted to jump on board that bandwagon. The direct integration wasn’t very common but a lot of the JavaScript objects had similar names (toString, etc.) and JS was commonly explained as a sort of junior relationship.
Edit: expanding my not very common claim — I first started using JavaScript when it was called LiveScript in Netscape betas, the second non-static website I built was Java (using DB/2 on OS/2 — I sure could pick winners!), and I worked at a web development company until 2001. During that time, you'd commonly hear about Java (along with Perl, PHP, Cold Fusion, and even C++) and we used JavaScript heavily but I never once met a client who was actually using server-side JavaScript although they certainly existed.
Remember, Sun needed Netscape to make Java successful. Today Java is a server-side technology, but that's not how it started its life. Java started its life as a technology to build more powerful web pages (using embedded applets). Sun needed Netscape to bundle Java into its browser. So if Netscape wanted to leverage the hype that existed around Java at that time then Sun had to let them.
>Java started its life as a technology to build more powerful web pages
I'm pretty sure Java came from the work James Gosling did on Oak, which was mostly used for embedded systems. I remember a lot of the early documentation being OO designs for devices like microwaves and CD players.
> I'm pretty sure Java came from the work James Gosling did on Oak, which was mostly used for embedded systems.
Yes, when it was conceived it was indeed intended for embedded systems but when it was released it was intended as a tech for building client-side smarts into web pages.
Java was originally conceived as Sun's response to General Magic's intelligent agent technology. Microsoft's response to General Magic was Microsoft Bob, because they saw General Magic's social interface as a threat to Windows.
This was voluntary. You have to remember that at the time the residing hype kings were the so-called 4GLs (e.g. Clarion, Clipper, PowerBuilder) and things like Visual Basic, Pascal (Delphi), etc. so Sun and Netscape were trying to present this as the pair of languages which you used to build the web, which was already emerging as the white-hot new thing starting to transform the world.
Such a shame Clipper and Delphi didn't worked out.
In early 90s my uncle (now 60 years old electrical engineer) taught himself clipper from 0 (no programming background whatsoever, and no English language) and wrote a software for capturing and analysing temperature curves of polymer ovens at a factory where he works that is still used to this day. They keep a DOS PC just to run it :)
I don't think it's possible to do this with modern programming technology, there's too many layers of abstraction and unrelated asides blocking people from "just making it work".
For what it's worth, Microsoft lost a lawsuit over their Java clone called J. Their Javascript clone was called JScript.
They made .net and C# instead and probably would have tried to make a new web language except that there was no room. One could argue that that VB.net was that language to some degree.
In fact Microsoft had their own browser scripting language, called VBScript. It was released in 1996 and only ran (runs) on Internet Explorer browsers (client-side) and Windows as an interpreter (Wscript.exe).
I ended-up using it extensively for a period of time from 1998 to 2002 to automate webpages that only ran in the intranet. I also used Wscript to run certain OLE or ODBC based automation (ie. grab data from Excel and write to a file) that was clunky to write in Perl.
Now look at what's become of Sun's trademarked logo:
Zuckerberg’s not-so-subtle message to Facebook employees: Don’t end up like Sun Microsystems
Facebook CEO Mark Zuckerberg has put a pretty hefty reminder for Facebook employees to keep striving for relevancy right outside the front door. An aging Sun Microsystems sign, on the back side of the Facebook sign, is a well-placed message to them.
According to the interview with Eich linked above: "Bill Joy at Sun was the champion of it, which was very helpful because that’s how we got the name."
Sure helps :-)
Edit: expanding my not very common claim — I first started using JavaScript when it was called LiveScript in Netscape betas, the second non-static website I built was Java (using DB/2 on OS/2 — I sure could pick winners!), and I worked at a web development company until 2001. During that time, you'd commonly hear about Java (along with Perl, PHP, Cold Fusion, and even C++) and we used JavaScript heavily but I never once met a client who was actually using server-side JavaScript although they certainly existed.