What is the difference between Java and JavaScript?

Java... JavaScript... wait they're two different things?!

That's right! Very different technologies with very similar names. They were both very popular in the 1990's due to the rapid expansion and popularisation of the internet, however it is JavaScript which has persisted and become even more popular on the internet, while Java in web browsers is almost totally non-existant.

What are they?

Java and JavaScript are both programming languages which were created and became popular in the 1990s with the rise of the internet. They both allow websites to have additional functionality and interactive elements to them. For example, on an otherwise boring and static website - you could program and add a game, an animated menu, a Video player, a calculator or some other interactive app in a website. These things are taken for granted these days but back then they were exciting and a big deal.

What were the differences between Java and JavaScript?

Java relied on web browsers having the Java plugin installed in order to run. Whereas JavaScript was nearly always just "built-in" to web browsers and didn't require any additional installation or configuration.

If you had the Java plug in installed, your web browser could run "Java Applets" which were basically little software programs in your web browser. Java applets were quite advanced for their time - the 1990s - and could be used to do advanced graphics and animations, whereas JavaScript was much simpler and used for different sorts of things.

The only thing that JavaScript required was that you had a browser which supported JavaScript (and by the mid/late 90s they all did) and that you had JavaScript enabled.

What were the similarities between Java and JavaScript?

One of the most interesting parts of both Java and JavaScript was that they were both "cross-platform" - in otherwords, you could develop the software on a Macintosh but it would work on a Windows computer without any extra modification or vice versa. This was a particularly big deal in the 1990s when there wasn't much cross-platform compatibility between different types of systems.

It was particuarly attractive to developers and companies who didn't want to develop software twice - they could write software and have it run on most types of platforms.

So what happened to Java?

One of the major attractions of Java was that it gave fairly basic web browsers - namely: Internet Explorer and Netscape Navigator (a precursor of Firefox) - the ability to do fairly advanced things. It gave them functionality which they didn't natively have. However, over time, those web browsers began to implement various features by themselves, bit by bit removing the need to have external plugins installed to do them.

A part of this change was that JavaScript was also becoming more and more powerful. JavaScript was also easier to develop software in than Java - you didn't need to know as much, and you also didn't need to rely on your visitors having the Java plugin installed. With the growing popularity of the internet in the 1990s and 2000s this mean that more and more developers were learning JavaScript instead of Java to do various bits of web functionality.

Java script also started to develop quite a bad security track record as well - because Java applets were more powerful than standard webpages and JavaScript, this also mean that if there were security bugs found in the Java plugin they could have wider reaching and more damaging effects than if there was just some problem with JavaScript.

By the time Apple launched the iPhone in 2007 Java's reputation (along with Flash) was already looking pretty shakey, but due to Apple's decision to not support Java on the iPhone (which by the way wouldn't have been a hard decision!) it was probably the final nail in all Java Applet's coffins.

Java lives on..?

While Java is essentially completely dead in our browsers - only still used by a very small minority of websites who haven't updated their systems in a long time - there are some corporations which have put Java to good use in other arenas.

One of the key attractions of Java - it's ability to run the same code on very different types of systems - means that it is still used in a number of places outside our web browsers; places where cross platform compatibility is still very important. One of the most popular childrens games "Minecraft" is written in Java and uses it to run. It's also possible to develop Android apps with Java. Java applications also exist in a lot of enterprise corporations and still has a strong development community behind it.

Do I need Java installed in my browser?

In short: probably not. Unless you're trying to use a very old website which still relies on Java Applets, you probably don't need it.

In fact, most modern web browsers don't even support the Java plugin any more! You won't be able to install and run it on Chrome, Firefox or Safari. You'd have to go digging for a much older version to find one that would still support it!

Do I need JavaScript enabled?

In short: probably! Although "good" websites won't require you to have JavaScript enabled (we believe JavaScript should nearly always be optional), you'll probably have a smoother time on the internet with it enabled.

If you want some fine-grained control over how JavaScript runs in your browser, you can use a browser extension/addon like NoScript (Chrome / Firefox) to JavaScript to work only on certain sites.

Conclusion

Hopefully that explains a little more about the differences between Java and JavaScript. In case it wasn't perfectly clear; you probably don't need the Java plugin installed in your web browser, but you probably want to keep JavaScript enabled.

Back to the Knowledge Base

Finished here? Go back to the Knowledge Base index.

Join Amazon Prime Music - The Only Music Streaming Service with Free 2-day Shipping - 30-day Free Trial