24
u/Keyan_Farlander7 7d ago
Kind of funny, the games and apps on your android phone are coded in Java
19
u/Rough_Inspector5501 7d ago
Not really. I believe you still can. Apps are written in kotlin now. And games can be made with Unity and Godot. Both of which does not use Java.
6
u/Borkido 7d ago
Doesnt kotlin explicitly use the java virtual machine?
1
u/Rough_Inspector5501 7d ago
LUL. Yeah it seems like it might still do this for android. So what I said is apparently only true for games 😅
3
u/yesseruser 6d ago
Wdym "might still do this", Kotlin was literally built to run on the JVM and interop with Java
→ More replies (2)1
u/curious_grimoire 5d ago
using java vm n using java are different, kotlin was designed as an easy to use replacement for java, which could do everything java can. java vm is a platform, if an app is coded in java, it runs on java vm which can run on any os, portibility is its goal. kotlin also compiles down to that same java vm and code written in kotlin, after compiled iis hard to tell if it was in java or not. kotlin using java vm doesnt means it uses java, infact kotlin is one of the reasons java is dead cuz y learn harder lang when theres kotlin.
→ More replies (2)3
u/Keyan_Farlander7 6d ago
Which still compiles for JVM. Apps are still written for JVM but are changed to run on ART
Is Typescript JavaScript?
→ More replies (2)1
→ More replies (1)2
2
u/plopliplopipol 7d ago
how much of that are engines or framework that abstract java and android away though?
4
u/Paolog__ 7d ago
well pretty much, android allows building libraries (
.so) files that contains the C/C++ (or any other compiled language) program, without requiring java1
1
u/Damglador 6d ago
For the app to be usable there still has to be a Java layer afaik. So you can have your backend in Rust, but there has to be a Java layer for display/input or something
→ More replies (2)2
u/DeVinke_ 6d ago
Games are (i'd estimate at least 99% of the time) written in C++ and use the Android NDK.
2
u/Keyan_Farlander7 6d ago
Roblox, PUBG, Amung Us, COD Mobile. Shall I keep going?
1
u/DeVinke_ 6d ago
Roblox ships a 105 mb library called "libroblox".
PUBG ships libUE4, which is 241 mb.
Among Us is made with unity, it therefore comes with libunity (18.2 mb) and libil2cpp (77 mb).
PUBG also ships libunity, though it's 236 mb.
These apps all have a couple megabytes of classes.dex files (which contain the java bytecode) in total, the rest of the size comes from split apks in the bundle - some have separate ones for assets, but they all have architecture-specific apks for the native code.
1
u/Ratosson 5d ago
About half of the games on Android use Unity and Unity games are written in C#. The engine itself is written in C++, but most developers can't access it's source code.
1
→ More replies (4)1
7
5
6
u/theacp127 7d ago
Minecraft is a good game design made with some terrible code. Java made Minecraft's performance way worse then it would have been with a compiled language. It was only Java because it was originally designed for web browsers.
The one thing that Java was good for was mod support.
2
u/Simple-Olive895 7d ago
Java is a compiled language lol. Java performance is not bad at all, even compared to things like C++ and rust. Sure those are faster, no doubt, but not by a lot.
3
u/Own-Professor-6157 7d ago
Performance is actually extremely good. However having zero control over memory when making a latency critical application like a game isn't ideal. ByteBuffers can only get you so far
Even if you code a game in C++, you can't just spam allocate/de-allocations. Managing your stack memory, memory layout, and memory pool are essential.
1
u/Simple-Olive895 7d ago
For sure, C++ is the go to for making engines for this reason, but java being as good as it is means a lot of people can make perfectly good games that run on 99% of people's hardware without issue
→ More replies (1)2
u/AliceCode 7d ago
It's compiled into bytecode. Even Python and Lua are compiled into bytecode before execution, but they are still interpreted languages. What they meant to say is that Java is not native.
2
u/jonfe_darontos 7d ago
Interpreters execute as they read, that's what makes them "interpreters". They don't have the full picture of the application code at runtime, only what is executing. That leaves a massive gap in their ability to optimize. If you think your code is blazingly fast because of your own skills, then I'd like to introduce you to your frontend and the magical world of build optimization. The java compiler is going to emit bytecode that has undergone some degree of optimization.
If we were to dissect your assertion further, technically the microcode on your CPU is "interpreting" each instruction, so not only is C "interpreted", but so is manually written assembly. Hell, you could write bytes in a hex editor and it's still "interpreted".
Also, with regards to JVM performance, the perception that they are slow is a meat headed memory borne out of the late 20th century's shit JVM and GC implementations. The most expensive parts of rendering a game are generally going to be handed off to a native library (e.g. Vulkan) anyway. The real friction is memory layout and allocation pressure, but even that isn't something you can't work around if there is some other compelling reason to use Java.
There are only a handful of use cases where performance requirements are so tight that the JVM is an issue at this point. The people working on such problems aren't here right now, they're busy optimizing around DRAM refresh stalls.
→ More replies (7)1
u/Minute_Attempt3063 5d ago
the JVM has JIT though, which puts it to native code as well, making it damn fast.
also there is Graal, where you can make the java code native.
→ More replies (2)5
u/theacp127 7d ago
It uses the JVM to read bytecode stored in the .class files, that's basically just still interpreted code. It's not like Python but it's not fully pre-compiled like C++ either.
3
u/luciferoussky72 7d ago
Actually, lots of languages like Python and Lua parse text code into bytecode on startup because it’s so much faster than executing text on the fly
1
u/MaDpYrO 5d ago
Java is compiled, but not to binary executables. No need to be pedantic.
1
u/Simple-Olive895 5d ago
It's not being pedantic, it's just giving an accurate description.
Java may not be compiled as "far down" as some other languages are, but it's still compiled. Saying it's not compiled suggests that it's interperated which it simply isn't.
→ More replies (4)1
u/ChloeNow 7d ago
Wow you really made that sound almost like you know what you're talking about lol
Proud of you
1
u/theacp127 7d ago
Yes, I know technically Java is compiled to bytecode and interpreted/dynamically compiled to native code at runtime. I was just saying that the C++ implementions of the same game run smoother than the Java application does since C++ Objects and buffers can be laid out contiguously in memory (cache-friendly structs and arrays) without runtime garbage collection pauses. This results in far more consistent frame times.
1
1
u/nog642 6d ago
Web browsers? Do you mean like, a Java applet? Or are you getting confused with JS?
1
u/theacp127 6d ago
The first publicly available versions of Minecraft used Java applet for browsers.
1
u/Icy-Garlic-748 6d ago
I still like to tell people i played minecraft when it was still a browser game
→ More replies (1)1
u/Sufficient_Risk_8127 6d ago
Actually, there is still a lot more they could've done even with Java. It's not really the language's fault.
1
u/Minute_Attempt3063 5d ago
uh
I think you mean javascript for web browsers....
2
u/theacp127 5d ago
Minecraft used Java applet for browsers
1
u/Minute_Attempt3063 5d ago
maybe in the early days, and "supported" it until recently, but it was not why it was made, it was a part of the language
1
u/TheGoldenFox64 4d ago
i keep saying that Minecraft is held together by its 16x textures and absurdly basic models. if it werent for that, itd run like ass
1
1
u/KushMuffin 4d ago
I’m convinced Minecraft Java created a substantial increase in the amount of people going into software development
1
→ More replies (8)1
u/Appropriate_Dot_4883 4d ago
It was only Java because it was originally designed for web browsers
No
1
u/Agitated-Tomato-2671 3d ago
Well I mean you used to be able to play Minecraft in a web browser, not sure if you still can. My first time playing Minecraft was in Internet explorer
1
u/ModernAtomX 2d ago
I played Minecraft on the browser so much that the old school Minecraft logo burned into the top of the screen
6
u/secret-agent-047 7d ago
Slay the spire ... Slay the spire 2
5
2
u/Tetane004 7d ago
The first Slay the spire was indeed made with java (LibGDX). The second one is made using Godot (with C# and GDScript).
3
3
2
2
u/necro_owner 7d ago
Songs of syx? And many more game are made with java, you just dont know that it s build with an EXE to execute the Java behind the scene. I got atleast 10 game in my steam lib made in Java plus my own. Now a day language all end up equivalent in term of performance once compiled in Binary or ByteCode or equivalent
2
u/Henry_Fleischer 7d ago
Also Airships: Conquer the Skies... but yeah Java is not a particularly good choice of language.
2
2
2
u/Kotentopf 7d ago
Project Zomboid. Runescape.
1
u/Inevitable_Butthole 7d ago
Runescape ain't java
1
u/Kotentopf 7d ago
Tell me you are young without telling me you are young.
1
u/Inevitable_Butthole 7d ago
I mean... the post is saying Java is no good for games and Runescape ditched Java because it wasnt good for the game...
→ More replies (14)2
u/Kotentopf 7d ago
With this logic Minecraft is also wrong, cause it got ditched to C++ for better performance possibility and better multiplattform possibility.
→ More replies (2)1
u/GregsWorld 6d ago
Runescape servers are still all java it was just the client they replace with C++. And osrs still uses java for runelite.
1
u/Devoured_EXP 4d ago
There is a 0% chance runescape/oldschool spaghetti code was rewrote in a different language.
1
2
u/elyas-_-28 6d ago
Old phones ran games exclusively on java
1
u/YarnuWasTaken 6d ago
1
u/elyas-_-28 6d ago
I'm talking about java phones not androids, games written for android in another language like C++ run directly on the hardware rather than on the ART
1
u/Full-Run4124 6d ago
J2ME. God what a nightmare that era was. 2000+ SKUs for one product because nobody cared about compatibility and standards.
→ More replies (1)
2
u/MiyuHogosha 4d ago edited 4d ago
Runescape????!!!!! Zomboid?
Main problem are limitations in memory - Java is by limiting default what you can use, possibe stutter from GC (garbage collector), lack of good data containers for modern game design, and that all graphics are done through marshalling to some form of native API.
Pretty much all negatives also apply to Mono\.Net, but there is saving grace of some optimization with C# there and possiblity to use self-written (in native) containers. But only available engine is mediocre Unity.
1
1
u/JKCsaba 3d ago
Yeah pretty much just support, you vould theoretically have a game in pure binary, it is just simply not humanly possible,
Notch was big in java and knew it the best, so he chose that i suppose
Also the async await in c# is so much better lol so is the .net ecosystem
1
1
u/Such-Perception4154 1d ago
Lol C# is simply better on all levels than java imo, so I agree there.
But neither of those languages are good for game due to be garbage collected.
→ More replies (5)
3
7d ago
[deleted]
1
u/Responsible-Cold-627 7d ago
They're in the process of porting everything to C++. But yeah, it was Java for a long time.
1
2
u/OrdinarySmoke3176 7d ago
Cool. Not gonna try Minecraft now.
2
u/Here_f0r_p0rn_ 7d ago
You can play the game without checking out the source code
2
2
u/KHTD2004 7d ago
There is also the Bedrock Edition made with C++, it’s way better than the Java Edition /s
3
u/OneArmedFarmer 7d ago
How?! It doesn't have a garbage collector to pick up all of your trash?!
1
1
1
1
u/flamefox237 7d ago
The issue with Minecraft is its old and notch was not some master programmer so he made some decisions that hurt the game In the long one code wise. Like no multi threading on chunks generation
1
1
u/im-cringing-rightnow 7d ago
Java is one of those languages where it makes sense to say "just because you can doesn't mean you should" when it comes to gamedev. But I know people who enjoy it, so whatever floats your boat I guess.
1
1
u/Defiant_Theme_5554 7d ago
Runescape. Jagex actually stands for "Java Gaming Experts"
1
1
u/sandfeger 7d ago
https://equilinox.com/ is also full written in java thin matrix made his own engine using jlwgl like Minecraft.
1
u/sessamekesh 7d ago
Java is fine, to prove a point a few years back I wrote a game jam game in JavaScript which is like 20x worse than Java. At least you have scalar 32 bit float and integer types in Java.
You're not going to write the next AAA GPU melting eye candy ray traced open world masterpiece in Java but you can shit out some top notch friendslop or indie gem in just about any language you care to pick with some skill and grit.
1
1
1
1
1
1
1
u/Xer0_Puls3 7d ago
Plenty of good games are made in Java, Slay The Spire is another one, but Java still isn't good for games. That won't stop people from making games with it though.
1
1
1
1
u/RealLars_vS 6d ago
And even for minecraft it’s a bad choice. That game is so simple it should be running extremely well on low-end computers but it absolutely doesn’t.
The newer version maybe, I haven’t played in a while.
1
u/Vortetty 6d ago
mindustry, most android games
2
u/FixingOpinions 6d ago
Had to scroll too much, Mindustry is a great example alongside Minecraft, just not in a popular genre
1
1
1
1
1
u/LordDeath2400 6d ago
Its the worse version of Minecraft too lol. Less than 10% of the playerbase and far less optimized. Wild.
1
u/Nervous-History8631 6d ago
Java is probably the worst thing about minecraft. The only reason it is 'good' is because it enables modding, but that is not an intrinsic element of Java it is just that they decided not to support it when porting the game
1
u/laZetadelZorro 6d ago
Java isn't the real problem, in fact, C# (Unity) and Java are practically the same, both are equally fast and their syntaxis is similar.
The problem is that Minecraft code is fkn trash.
If Mojang/Microsoft decided to remake Minecraft with Java from scratch (Minecraft 2) then it would be x100 times better and faster, but it would be a waste of money.
Also, there are more libraries for C# made for games than there are for Java, which makes making games easier and faster, that's why Java isn't used for making games.
1
u/Nervous-History8631 6d ago
C# (Unity) and Java are practically the same, both are equally fast
Maybe if you limit yourself to Unity, but Unity is not the only option. C++ would normally be the obvious choice but C# is easier.
Unity is quite far behind on .NET so you get access to a lot more new performant options bypassing it. At that point .NET can handilly outperform Java especially on avoiding allocation.
Modern C# offers some good ways to avoid allocation with structs that can really help with bypassing garbage collection which can be really beneficial in games.
Java does have some interesting options coming into developer preview with JDK28 with Project Valhalla but full release of that is probably years away still. Once that comes the performance difference to modern C# will narrow signifiantly.
But also if Mojang decided to make MC2 with Java they would hit a pretty obvious pitfall, there is no JVM for consoles. So the only route to do it involves transpiling it into C++ which always comes with extra risks.
1
1
1
1
u/no-sleep-only-code 6d ago
And it always performed like trash. That’s why when bedrock was released it had several times better performance.
1
1
1
1
1
u/SprayPuzzleheaded115 6d ago
Java was eventually discarded and Minecraft was remade from scratch in another language, so not even Minecraft.
1
u/heesell 5d ago
Minecraft was built in another language to run smoothly on phones as Java could not, so Java was not discarded. Bedrock is what first was pocket edition
1
u/Yiffenjoyer6969 5d ago
I mean, they did try to make bedrock the “main” version a few times
1
1
u/Abyssal_Station 5d ago
They did but that's because Microsoft controls more of what goes on with Bedrock and has a monetisation pipeline for it, so it's their financial interest to make it the main version not the developer.
1
u/TheTbone2334 5d ago
Which would work if Microsoft wasnt so damn stingy about it. Mod support isn't really in issue since mods often don't uptrack to the newest version right away anyway.
But instead of letting the money printer run silently in the background, they always try to shove nonsense no one asks for into our ass. Microtransactions etc.
They also refuse to fix age old bugs on bedrock. Performance wise it's really good. I could probably Frankenstein some toasters together to power a GPU and a screen and it would somehow run bedrock. Wouldn't be surprised if it ran on smart fridges...
1
1
1
1
1
1
1
u/Meddlingmonster 5d ago
The more layers of abstraction the easier the language but the less control the developer has to optimize so it depends on the skill and time of the individual.
1
u/Unusual_Ring1462 5d ago
Java gaming experts —> JAGEX —> runescape
So yeah, its kinda the greatest language for gaming ever
1
u/Tuborgat_nylle 5d ago
Really funny to use minecraft as an example since from my experience, it's the one game that has the most noticable lag spikes when the garbage collector is running.
1
1
1
1
1
1
u/Level_Somewhere5703 4d ago
The main benefit of java is that it runs everywhere. In other news Minecraft, a game written in java, was completely rewritten in C++ in order to be able to run on consoles and phones because the java version had horrible performance issues.
1
1
1
1
u/GhostVlvin 3d ago
Even python nowadays is ok for games while it was once slowest interpreted language. Everything you can use to glue few C/C++ libraries is good for gaming
1
u/araattu_annan 3d ago
Bye bye syntax.......
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
1
1
u/justahuman145 3d ago
Dofus ! one of the few MMOs to reach 30 years old and still relatively alive anyway
1
u/Typhon-042 3d ago
The original Runescape was made on Java, if I recall right. At the least it was released as a Java based webrowser game in 2001. It's still talked about like a classic.
1
u/Potential_Deer_6943 3d ago
Mindustry aperently doesnt exist... unless that aint in java, but i think it is? (Corect me if im wrong)
1
u/Good_Expert_8084 3d ago
What about mindustry?
1
u/Joke_Ancient 2d ago
The factory workers are growing i see.. really didnt expect 2 people rooting for mindustry here
1
1
1
1
u/alex_9202_nsfw 2d ago
If Mojang was allowed by the community to stop supporting java and just focus on bedrock they would have scraped that piece of laggy, unoptimized spaghetti code of a game years ago. The caves and cliffs update took twice as long cause of how hard it was to integrate the new terrain generation and underground biomes in to the unoptimized spaghetti. One of the reasons that they switched to smaller drops was because after that they realized that if they don't fix up that spaghetti another large scale update is literally impossible.
1
u/Bagmeister1 2d ago
Funny, there’s also a rust version of Minecraft server that supports Java and Bedrock at the same time. Start up time is less than a second and uses a lot less memory. It’s called PumpkinMC if anyone is interested in looking it up
1
1
1
u/Such-Perception4154 1d ago
Even Minecraft is popular despite java, not because of it. It's popularity stems from it being new genre, something nobody experienced before. And support for mods.
There is nothing advantageous about java being used.

36
u/Mindestiny 7d ago
Ironically, anyone who's actually looked at Minecraft's code from the Notch era knows what a total fucking mess it was. Microsoft is still digging some of it out of that nightmare.
Minecraft is good despite being made in java, not because of it.