14 ms·
I still don't know why they stuck the "Java" name on JavaScript. Very confusing when the two languages are completely unrelated. > Java programs and JavaScript
by overkill28 6y ago
I still don't know why they stuck the "Java" name on JavaScript. Very confusing when the two languages are completely unrelated.
> Java programs and JavaScript scripts are designed to run on both clients and servers, with JavaScript scripts used to modify the properties and behavior of Java objects, so the range of live online applications that dynamically present information to and interact with users over enterprise networks or the Internet is virtually unlimited.
Was this level of integration ever achieved? Did Java applets actually have a JS API? Or is this just corporate double speak.
- Azleur 6y agoMarketing move. Same reason they shoehorned constructors into a prototype based language. Java was all the rage in '95.
- Yaggo 6y agoNot only the name, but also the C-like syntax was borrowed from Java because of marketing reasons, despite the semantics were inspired by quite different languages such as Scheme and Self. What a pity!
- Tade0 6y ago> Did Java applets actually have a JS API? It was possible to expose something: https://www.codejava.net/java-se/applet/liveconnect-the-api-for-communication-between-java-applet-and-javascript https://www.codejava.net/java-se/applet/liveconnect-the-api-...
- bawolff 6y agoYes, there was an api. https://developer.mozilla.org/en-US/docs/Archive/Web/LiveConnect https://developer.mozilla.org/en-US/docs/Archive/Web/LiveCon... That said, the nomenclature was pure marketng bs.
- tbranyen 6y agoDefinitely, HTML has several tags to help work with external types. You can interface with java, vbscript, flash, pdf, etc. You could absolutely expose top level methods and invoke them in JS.
- pqb 6y ago> I still don't know why they stuck the "Java" name on JavaScript. It is still funny to see a job offer with a mistaken Java and JavaScript posted in a title or in requirements section.
- acdha 6y agoMarketing. 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.
- ChrisRR 6y agoIt's very odd, if someone nowadays called their language CSharpScript, they'd get slapped with a C&D
- codetrotter 6y agoSun was literally in on it though? So it'd be like if whoever was announcing this hypothetical C#Script was doing so together with Microsoft..
- m_st 6y agoAccording 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 :-)
- astura 6y agoNetscape had permission from Sun to use the "Java" name, it was a partnership. This press release itself even says it in the first sentence >Netscape Communications Corporation (NASDAQ: NSCP) and Sun Microsystems, Inc. (NASDAQ:SUNW), today announced JavaScript
- acdha 6y agoThis 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.
- astura 6y agoBrendan Eich addresses that topic in this interview. The whole interview is (very much!) worth a read but here's some key parts about the name https://www.infoworld.com/article/2653798/javascript-creator-ponders-past--future.html https://www.infoworld.com/article/2653798/javascript-creator... >It was all within six months from May till December (1995) that it was Mocha and then LiveScript. And then in early December, Netscape and Sun did a license agreement and it became JavaScript. And the idea was to make it a complementary scripting language to go with Java, with the compiled language. >[The idea of an accessable scripting language] was very strongly held by Marc Andreessen and myself. Bill Joy at Sun was the champion of it, which was very helpful because that’s how we got the name. And we were pushing it as a little brother to Java, as a complementary language like Visual Basic was to C++ in Microsoft’s language families at the time.
- blakesterz 6y agoInteresting! "JavaScript would have been the ideal name because that’s what everyone called it and that’s what the books call it. Microsoft couldn’t get a license from Sun so they called their implementation JScript. So ECMA wanted to call it something and they couldn’t get anybody to donate or they couldn’t get everybody to agree to a donation of the trademark, so they ended up inventing ECMAScript, which sounds a little like a skin disease. Nobody really wants it. "
- dr-detroit 6y agoNot supposed to talk about Bill Joy hes not a gazillionaire eCeleb
- derefr 6y agoSo, basically, JavaScript was originally annointed to serve the function within the JVM ecosystem, that ended up being served by Groovy? Why didn’t that happen? And why did it take so long before we got Groovy instead, if Sun wanted was imagining something like it way back in 1995?
- alisonkisk 6y agoSun had some great people and some good ideas and products, but as a coherent business it was a rolling train wreck.
- andi999 6y agoEspecially when you couldnt even google it (the other search engines never found anything related to my keywords...)
- AndrewStephens 6y agoPartly marketing but the integration certainly existed. As I recall, public methods in the main applet class are exposed to JavaScript. It was a little slow and clunky but it worked. The idea was similar to how web components are used today. Your web page would contain custom applets for a fancy input field, a calendar control date picker, and whatever other controls html didn’t provide, all implemented as Applets. It could have worked out and the web today would have looked very different except that Java applets always performed terribly on first load. Nobody wanted to have their customers wait 30 seconds for the custom controls to initialize. I sometimes wonder what might have been if Sun had actually fixed the initialization of Applets. In many ways Applets were nicer to develop than today’s web components.
- ethbr0 6y agoTechnically, why are / were Java applets so slow? I never dug into the ecosystem deeply enough to understand (plus a bit before my time). Was it JVM startup time, Java xfactory-begat-y-begat-z code init time, what? Also, applets run outside the browser, correct? I.e. on the browser's host system in a separate JVM process?
- dtech 6y agoA combination of needing a heavyweight VM separately from the browser and being either interpreted or having to wait for a slow JIT. Remember Javascript was slow as ass too until the late 2000's when browsers were implementing efficient JS engines. If web pages would've been build like common JPAs they would've been as bad as applets.
- other_herbert 6y agoThey didn’t have to be slow and you can communicate between the two with a parameter in the applet tag “ mayscript” with that methods in the applet could be called from JavaScript. I used that for an invisible applet that would handle communication and drawing HTML to the browser.. kind. Spa like way back in the Wild West days when applets could nearly do anything.
- AndrewStephens 6y ago
- forgotmypw17 6y agoIt's because you could integrate a Java applet with JavaScript in the page and have it all interoperate. Pretty cool, too bad Java was so heavy...
- Supermancho 6y agoSome of the JS api (method names) matched the uniquely Java api.
- makecheck 6y agoThere is a JavaScript interpreter built in to Java (or more than one, in that you could choose at least one older one at the time I tried it). I used this for a fairly complex app and found it surprisingly easy to let it parse JavaScript and affect the Java program, moving data back and forth.
- dragonwriter 6y ago> There is a JavaScript interpreter built in to Java Are you referring to Nashorn? If so, wouldn't "was" be the correct verb, not "is"? https://en.wikipedia.org/wiki/Nashorn_(JavaScript_engine) https://en.wikipedia.org/wiki/Nashorn_(JavaScript_engine)
- hathym 6y agoThat is why it was renamed to ECMAScript
- everlost 6y agoThe biggest irony is that they believed Javascript "complemented" Java!
- stephenhuey 6y agoAs others in this discussion have pointed out, Sun intended this because they wanted people to see Java as the server side language so even though applets could run Java in the browser they never did much to improve performance because they expected people to rely on JavaScript in the browser (and buy their expensive servers to run Java).
- bobince 6y ago> Did Java applets actually have a JS API? Sure. LiveConnect was commonly used as glue to invoke and interact with applets from JS. I wouldn't necessarily say that it enabled a virtually unlimited blah blah enterprise parp, but it had its uses. A common hack was to put some shared storage in an applet so multiple documents could use it to persist and communicate cross-document data, back before browsers could do that natively. There was some really tedious bug in IE with the Sun VM that occasionally allowed JS events to fire concurrently whilst LiveConnect was waiting for a response from a method called on an applet, which we never quite figured out. This was one of many things that made JS+applet development unreliable and unpleasant.
- ahlschwede 6y agoBefore Ajax one way to do Web 2.0 style interactions was to hide a Java applet in an invisible iFrame and feed data back and forth from the page using JavaScript. I think people forget that the early web had a proliferation of plug-ins. JavaScript was most often used as glue between HTML and plug-ins which had fewer platform incompatibilities than the browsers. One of the reasons Flash became the dominant plug-in was because it was universal enough to duplicate the features of other plug-ins, including asynchronous communication via Java applet.
- moron4hire 6y agoIFrames were invented later (and initially, only in IE). You also didn't ever need to put the applet in a separate frame. You could just put the applet on the page. Indeed, putting it in a frame would have defeated the purpose, because there was no way to communicate across frames at the time.
- coliveira 6y agoIt was just a marketing ploy based on the cooperation between Netscape and Sun. Sun would provide interoperability between JS and Java in the browser. Netscape would get the public support of a major corporation at a strategic time in its fight against MS.
- nickbauman 6y agoYeah it was called Live Connect and it was pretty amazing. It's long since gone though. https://developer.mozilla.org/en-US/docs/Archive/Web/LiveConnect/LiveConnect_Overview https://developer.mozilla.org/en-US/docs/Archive/Web/LiveCon... FWIW as a Clojure/Script developer this technology would have been kind of mind-bending if it still existed.
- reaperducer 6y agoVery confusing when the two languages are completely unrelated. I once had a boss who thought I could write Java Android apps because I knew Javascript from web development. "They're the same thing, right?" Lifting a line from somewhere deep in the bowels of the internet, I told him that, "Java is to Javascript as ham is to hamster." Got fired shortly after that. Company folded a couple of weeks later. Life moves on.
- Rompect 6y agoI always use "Java is to Javascript as a car is to carpet" but yours is also good.
- hi41 6y agoAs a new developer in early 2000, I couldn’t tell the difference between Java and JavaScript. I felt very ashamed of that.
- valw 6y agoWhen you're in the business of sneaking in a Scheme-inspired language into the universal programming platform in a world of object-oriented dogma, you'd better add some camouflage ;) And so the language was compromised in its name, and arguably in its syntax and (lack of) macro system.
- deleted 6y ago[deleted]
- robbrown451 6y agoThey aren't really unrelated as they explicitly made JavaScript syntax "look like Java" which in turn "looked like C and C++". This also helped with their LiveConnect stuff which allowed the two to talk to each other. I think it was a huge selling point that the languages felt similar, and felt comfortable to those who already knew C and/or C++. In those days I was doing a lot of pasting from one language to the other, and editing "int" into "var" etc. Java and JavaScript were similar in that, compared to C and C++, you just sort of forgot about pointers and pointer syntax. (even though they still sort of existed). They sure seemed to me to be related. This is obviously most true for light use of the languages (JavaScript especially was designed for very light use)
- spullara 6y agoA few answers based on my recollections. JavaScript was a trade with Sun. Sun allowed them to name it that and Netscape integrated Applets into the browser. As for the API, yes. You could control the DOM from Java without the big grey square of an applet through an API built into browers at the time: https://web.mit.edu/java_v1.5.0_22/distrib/share/docs/guide/plugin/developer_guide/java_js.html https://web.mit.edu/java_v1.5.0_22/distrib/share/docs/guide/... However, it was rarely used. The world might be a far different place if folks had used a higher performance (and at the time far more capable) language for manipulating the DOM early on rather than the focus on recreating the whole UI of the application on a canvas.
- deleted 6y ago[deleted]