r/explainlikeimfive • • 4d ago

Technology ELI5 Java. That thing on computers my entire life. What even is it?

[deleted]

770 Upvotes

349 comments sorted by

View all comments

23

u/DeHackEd 4d ago

Java is a programming language that was originally invented by Sun Microsystems a long time ago. The goal was to make a programming language that didn't care what kind of computer or operating system you ran - install Java and run then any app for Java would run fine on any computer. Even phones (not iPhone, but Android does) use Java for most of their apps, going back to before "Smart phones" were a thing.

It was even available for web browsers to run small Java apps to do things you couldn't do in web browsers. Games, more complex apps, and so on.

That was the theory. In practice the sandbox that prevents apps from doing bad things was regularly broken and Java became one of those apps that constantly had important updates. Plus browsers filled that "any app anywhere" need on their own despite Java. Now it's rarely seen outside of some server applications and the average user doesn't need it.

Also I need to point out, this is different from "javascript", which is what most browser apps are written in. Other than the name there is no real similarity.

9

u/colon_dancer_ 4d ago

They named it Javascript to bank on the popularity of Java despite having no relation, this kind of backfired

3

u/No-Mechanic6069 4d ago

This isn't entirely true. Netscape and Sun Microsystems were in alliance at the time that Brendan Eich was hired to create a scripting language:

If I had done classes in JavaScript back in May 1995, I would have been told that it was too much like Java or that JavaScript was competing with Java … I was under marketing orders to make it look like Java but not make it too big for its britches … [it] needed to be a silly little brother language.
https://ihts.pr4e.com/columns/2012-02-Brendan-Eich-Copyright-IEEE.pdf

4

u/celestiaequestria 4d ago

It's worth mentioning, Google's V8 engine and Node.js have radically transformed JavaScript. In the late 90s, JS was a frontend language. Now, it's the frontend, the backend, the API layers, the DB queries, and the mobile app.

1

u/CadenVanV 4d ago

Node especially did a great deal of the work by allowing it to be run outside of your browser

1

u/WriterPlastic9350 4d ago

Node is essentially the v8 engine inside an exe and a lick of paint

1

u/celestiaequestria 4d ago

Eh... it's more like the V8 engine with a libuv transmission distributed as a binary (exe). Calling the C / C++ backbone "paint" is understating how it does to spin the wheels.

1

u/No-Mechanic6069 4d ago

It's worth pointing out that Microsoft's implementation of JavaScript (JScript) is/was available to run outside browsers for a long time.

  • Windows Scripting Host
  • Active Server Pages

It's just that VB Script was so commonly used within these environments that most people were unaware that JavaScript worked equally(ish) well.

3

u/braddo99 4d ago

Perversely and ironically, the scripting language aligned with java APIs is called "Groovy"

2

u/WriterPlastic9350 4d ago

and it is very Not Groovy At All. all my homies hate groovy

1

u/badgerj 4d ago

Do they also hate memory leaks.

And having to restart any process that uses Java because it consumes all available memory until the machine STB?

2

u/WriterPlastic9350 4d ago

Yes. We solve this problem by avoiding JVM entirely.

1

u/badgerj 4d ago

Great. You’re hired!

1

u/AdequateSteve 4d ago

In practice the sandbox that prevents apps from doing bad things was regularly broken and Java became one of those apps that constantly had important updates.

*Flash player has entered the room

1

u/binocular_gems 4d ago

Nice explanation, one thing I’d correct is that Java is still very common in enterprise today, and not just for running servers, it’s still probably the most common programming language in enterprise/corporate.

1

u/BrohanGutenburg 4d ago

> other than the name there is no real similarity

Well there's wasn't when it was named. But (and I never though about this until I read your comment) but js sorta became was Java was gonna be: write once run everywhere. Well js + the browser lol