# Relationship between Java and JavaScript

> Are Java and JavaScript really as unrelated to each other as India and Indonesia? Come to think of it, these two languages are more related than you might think.

Are [Java](https://wiki.g15e.com/pages/Java.txt) and [JavaScript](https://wiki.g15e.com/pages/JavaScript.txt) really as unrelated to each other as <India> and <Indonesia>? Come to think of it, these two languages are more related than you might think.

## Origins

In the early to mid-<1990s>, they were considering [Java](https://wiki.g15e.com/pages/Java.txt) and <Scheme> as the language to put into <Netscape Navigator>. If Scheme had been adopted, <functional languages> might well have become hugely popular. But instead of Scheme, the direction shifted toward making a new scripting language that was "similar to Java," and as a result a language called <Mocha>, with syntax similar to Java, was born (I never got to see this one). Mocha soon changed its name to LiveScript, and then, when Java became famous, changed its name again to [JavaScript](https://wiki.g15e.com/pages/JavaScript.txt).

## Libraries

JavaScript not only borrowed Java's syntax, but also took over some <APIs> from <JDK> 1.0 almost as-is (for example, Java's `java.util.Date` class. No comment). There was a time when Java ran well in browsers (<Java applets>, remember?), and through a technology called "LiveConnect," bidirectional calls between Java and JavaScript were even possible.

## Engine

<Rhino>, a JavaScript engine implemented in Java, has existed since as early as <1997>, and before <Node.js> it was one of the reasonably decent solutions for running JavaScript on the server side. I learned about Rhino sometime around the mid-<2000s>, and I remember finding it useful from time to time. Before that, it seems <JScript>, <Microsoft>'s JS implementation, was (probably) the most stable platform for running server-side JavaScript. (<Windows Scripting Host>, remember? <IIS>, remember?)

In various senses, the two languages are quite closely related to each other.