I have scoured the internet, but there are not very many resources for Java game development, not nearly as many as C++. In fact, most engines are written in C++. I tried to play a game made with jMonkeyEngine, but the game was terribly slow, to the point where my computer froze. I had no other Java applications running, and nothing too resource intensive. In contrast, my computer can play most modern 3D games with ease. If I continue to learn and improve Java now, and it turns out that later I am required to learn C++, making the switch might be difficult.

Is Java an acceptable language for serious game development? By serious, I mean high quality graphics, without much lag on modern computers. I also want to consider making games for consoles.

  • 25
    \$\begingroup\$ Isn't minecraft built with java? Or mainly OpenGL? Oh and check out C# if you are not 100% set on java, as it is awesome. \$\endgroup\$
    – Aralox
    Commented Mar 14, 2012 at 0:40
  • 7
    \$\begingroup\$ Why don't you come to the Stack Overflow C++ Chat? We love C++, we think it can absolutely be used right, and we know how to do that, and we'd be totally happy to share. \$\endgroup\$
    – DeadMG
    Commented Mar 14, 2012 at 0:59
  • 12
    \$\begingroup\$ Minecraft is java + LWJGL + Notch's coding skills, so performance-wise it is TERRIBLE. \$\endgroup\$ Commented Mar 14, 2012 at 1:25
  • 3
    \$\begingroup\$ Whether your coding games or anything else, locking yourself into a single language is not going to help you in the future. Branch out a bit, either C++ or something else like Python. It takes time, but it makes you a better dev. \$\endgroup\$ Commented Mar 14, 2012 at 1:34
  • 4
    \$\begingroup\$ You're going to get a lot of misinformation because the Java/C++ wars burn brightly, be prepared to ask for specific examples before accepting an opinion and also to research more on your own =) That being said, I agree with @loganfsmyth that you will need to know many languages because only then can you choose the right tool for the any task. In the immediate future if you just want to learn "game style programming" then use what you're comfortable with (Java) and then learn C++ later. Heck, later you may be doing content pipelines in C# and games in Java ME, hard to predict =) \$\endgroup\$ Commented Mar 14, 2012 at 2:08

8 Answers 8


Yes it is, check this list for a proof. Those are some games made with Java using The Lightweight Java Game Library (LWJGL). It is a low-level framework, which provides OpenGL for high quality graphics and OpenAL for sounds. It also provides input API. With these you can quite easily get started to serious game development in Java.

I am currently writing my second 3D game as a hobby project in Java, and I just love it. In the past I used to write my games with C++, but after switching to Java there is no going back. Supporting multiple operating systems with Java can be very easy, for example my previous Java game, which I developed in Windows for a year, worked in Linux right away and in OS X with only one bug without any need to compile anything on those platforms.

On the other hand, with Java you have couple of problems.

  1. Garbage collector. As others have stated, non-deterministic memory management is a problem, and you need to code that in mind.
  2. Lack of 3rd party libraries. Most of the available libraries do not support Java. On the other hand you always have the option to call these native libraries from Java also, but it's more work to do so. There are also Java ports or ready-made wrappers available for popular libraries, for example I'm using JBullet - Java port of Bullet Physics Library. On the other hand Java has a huge class library built-in, which reduces the need for third party libraries that are not game related. The lack of libraries has not been a problem for me, but I can imagine that it can be for others.
  3. Java is not supported by popular game consoles and there is no easy switch to those from Java as far as I know. On the other hand Android, which is a popular mobile platform, uses some form of Java. This is an option also, but don't except the same Java code to work both on a PC and Android device.
  4. Smaller community. Most game programmers use C++ and in my experience often dislike Java. Don't expect to get as much help from others. Don't expect to get a job in game development without C++ skills.

Not really. Here's the thing- firstly, there's very little in terms of existing libraries for Java compared to the virtually everything that is for C++.

Secondly, Java as a language simply doesn't lend itself well to game development- I mean, for example, if you're dealing with GPU buffers then Java does not provide a language feature which will aid you in ensuring they are correctly locked and unlocked or disposed of, which C++ does. Plus, there's the performance problem- and the GC is non-deterministic, which is super-bad for a game.

I have never observed any non-indie game which spent significant time in a language that was not compiled to native code prior to execution, and even the indie games which do so are a rarity. So my belief right now is that it simply cannot be done.

Also, if I continue to learn and improve Java now, and it turns out that later I am required to learn C++, will making the switch be difficult?

Yes, absolutely it will. Java and C++ are vastly different, despite their superficial syntactic similarities. Java experience counts for virtually nothing when learning C++.

Gameplay over graphics is a viable choice, and you can see it in the success of games like Terarria and Minecraft. But if you intend on creating srs graphics, then it's not going to be doable in Java.

  • 7
    \$\begingroup\$ +1 since he specified heavy graphics, fast game play without lag. \$\endgroup\$ Commented Mar 14, 2012 at 15:50
  • 1
    \$\begingroup\$ Java's lack of unsigned data types also stands against it. Yes, you can work around it, but it's not ideal and you'll be using code that doesn't really reflect the underlying data correctly. \$\endgroup\$ Commented Mar 30, 2012 at 20:25
  • \$\begingroup\$ @deadmg Is case of locked and unlocked, are you referring to some DirectX api functionality? & Can you tell me, what's so bad about having non-deterministic GC. \$\endgroup\$ Commented May 3, 2012 at 23:00
  • 1
    \$\begingroup\$ Non-deterministic GC can equate to dropping frames, if you get a bad stop the world pause and it locks things up for longer than it takes to render the frame. In practice this doesn't really happen often/ever if you plan your memory use, JVM's collectors can be configured for low pause (well within safe limits for frame dropping). Still, it's not a fun thing to have to deal with. You end up having to hand back significant amounts of the productivity that you gained when you left C++. \$\endgroup\$
    – Michael
    Commented Oct 22, 2012 at 2:27
  • 2
    \$\begingroup\$ A start you'll have to totally re-write. \$\endgroup\$
    – DeadMG
    Commented Aug 16, 2014 at 8:12

So, I am really serious about game development, is Java still a viable choice? I have tried multiple times to learn C++, but I don't really like the language. I don't really know why, but usually, whenever I try to learn, I can never grasp the topics.

If your reason for choosing Java is that you couldn't understand C++, your Java programs aren't going to be fast enough for high quality graphics. Using a higher level language should be because it makes you more productive, not because you couldn't understannd the lower level language.

I don't think it's an entirely bad idea to write a game in Java, especially if the game is simple, but you're immediately going to run into performance issues in Java if you're using it as a crutch.

So, in short, can Java be taken serious, for serious game development. This includes heavy graphics, fast game play without lag, and possibly, and easy switch to consoles?

  1. Heavy Graphics: Possible, but you're going to be doing the same thing in Java/LWJGL as you are in C++/GL: writing bytes to GPU buffers and/or using the deprecated display lists like Minecraft does. If you don't understand the memory management, you're not going to do this correctly either.

  2. Fast game play without lag: Not an easy task in any language, and you're more likely to shoot yourself in the foot either way without putting thought into it.

  3. No, Java is not going to be available on consoles.

  • \$\begingroup\$ As a side question, what replaced the display lists when they were deprecated? \$\endgroup\$
    – Suds
    Commented Mar 14, 2012 at 2:59
  • \$\begingroup\$ @Suds: Programmable pipeline, I believe. \$\endgroup\$
    – DeadMG
    Commented Mar 14, 2012 at 3:01
  • \$\begingroup\$ ha! already covered it. VBOs: gamedev.stackexchange.com/questions/22170/… \$\endgroup\$
    – Jimmy
    Commented Mar 14, 2012 at 3:01
  • \$\begingroup\$ Mobile platforms could be considered consoles. I realize he was probably talking about the big three, but Android uses Java and plenty of games are created for it. \$\endgroup\$
    – Amplify91
    Commented Mar 14, 2012 at 3:27
  • 1
    \$\begingroup\$ @Amplify91 yes a few games are written in java for android. But most good games and probably all graphic intensive or multi platform games are written in C++ using the Android NDK. \$\endgroup\$
    – Coyote
    Commented Mar 15, 2012 at 16:15

An experienced programmer will generally know many programming languages - learning extra programming languages isn't too hard once you know one well. However I would strongly recommend that C++ shouldn't be your first language, and probably not the second one either.

That's because C++ gets a lot of its efficiency from not doing any significant runtime error checking. For example accessing an element off the end of an array in Java will always throw an exception telling the programmer exactly what's wrong. In C++ you may get lucky and it will crash immediately, but very frequently it will silently trash some other data and the error won't show up till much later on.

I'd suggest you stick with Java for now (or switch to C# if you prefer that). That will let you get things done quicker than using C++, and performance on a PC shouldn't be an issue.

Think about learning C++ after you've completed a few projects in safer languages. C++ is what you'll need for most professional game development jobs.

Note that with the exception of C#/XNA getting a game you wrote onto a console at a minimum requires you to set up a company, with an office, and have a large budget available for development hardware and other expenses.

  • \$\begingroup\$ This is also exceptionally true because other languages beyond C++ will give you a sense of accomplishment. C++ can take hundreds of hours for what can feel like nothing. Learning other languages first lets you get your feet wet. \$\endgroup\$
    – Darkenor
    Commented Apr 22, 2013 at 17:07
  • \$\begingroup\$ Your comments about lack-of-error-handling are really about C (and so-called C++ code that really is C). C++ has standard libraries (and standard template libraries) that have much better error handling than what you describe. C++ also has vendor-provided libraries (such as MFC) that provide decent error handling. \$\endgroup\$
    – Jasper
    Commented Jul 2, 2016 at 13:09

Disclaimer: This doesn't exactly answer your question. However, I have attempted to (briefly) mention some points that may be of interest to you.

The reason that you see so much about C++ is because C++ is still the industry standard -- the most common language for consoles, etc.

Java is not frequently used. Minecraft is a pretty popular game that made it big with Java; but it's not that great graphically. Spiral Knights is not bad -- also made in Java, with significant graphics.

If you like Java, C# is very similar in syntax, with the advantage that it can interop with C++ -- so low-level stuff can be done in C++ if necessary. Unity can use C# for scripting, and XNA is an excellent choice.

Again, Java is not widely used. If you like the style and syntax, I think you'll find C# to be a very similar, very pleasant coding experience.

I hope your dreams make it, it's a lot of fun along the way :)

  • 9
    \$\begingroup\$ Lots and lots of inaccuracies in this posts. Minecraft "bad" graphics are not (heavily) related to the language. MC bad performance is directly related to Java being a bad language for games because HUGE performance issues, and LWJGL being an unsuitable library for big coding projects for the same reason. But the biggest factor was Notch's bad coding and implementation, which is being fixed...slowly. C# gives you all the ups of managed memory without most of the Java performance problems. The downside is that C# is heavily Microsoft-centered for both games and applications. \$\endgroup\$ Commented Mar 14, 2012 at 1:18
  • 3
    \$\begingroup\$ @EfEs: I hate to break it to you, but managed memory is terrible for games, and people who code games in XNA have to spend more time managing memory than people who code in C++. The non-deterministic nature of the GC means you have to pool practically everything and avoid allocation like the plague- not the way the language was supposed to be used. \$\endgroup\$
    – DeadMG
    Commented Mar 14, 2012 at 1:42
  • \$\begingroup\$ This answer was not meant to be 100% accurate; I only cited examples I know vaguely about. Feel free to DV. \$\endgroup\$
    – ashes999
    Commented Mar 14, 2012 at 3:13
  • 2
    \$\begingroup\$ @DeadMG I know C++ is the way to go, I was just trying to explain that C# is better than Java for games. \$\endgroup\$ Commented Mar 14, 2012 at 10:19
  • 5
    \$\begingroup\$ Being a long time C# developer (not game developer thought) I believe that pooling and memory management are great issues for any badly designed system. People with the C/C++ mindset and ways of development I know, hardly gasp into the managed memory, design and architecture patterns that must be used and take advantage of them in a language like Java/C#. What I am trying to say, is not that C/C++ techniques or products is bad, but that even if you use simpler languages in terms of syntax (like Java and C#), you still need lots of experience to design your game the right way. \$\endgroup\$ Commented Mar 15, 2012 at 11:34

Look dude, the simple answer to "Is Java viable for game dev" is an obvious yes. You can use any programming language to make games. That doesn't mean you should.

Probably the very things that turns you off from C++ (low level memory management, no garbage collector, having to pay attention to pointers, structs as arrays etc) are the very things that you should learn if you want to exploit a computer's resources most efficiently. Your games will run best if you are exploiting the computer's resources most efficiently.

Java does some things (such as array bounds checking) that just make it run slower. In this optimized Java Perlin noise example code, the author commented "(array access is a lot slower than member access)". This kind of thing is pretty counter intuitive coming from a C++ background. But in Java, such things are.

I say stop dodging the bullet, learn C++, and use it.


This doesn't answer your question; the graphics and console issues seem to be something you very much need to consider. Also GC affects on performance. But what I write about:

If you are writing large, complex, OO programs, you will write them 5 times faster in Java than C++. Also, maintenance will be vastly easier. I switched, (admittedly for non-game software), and my productivity skyrocketted. C#, another good alternative, is harder to learn than Java because there's a lot more of it. When you know it, you can write code even faster than in Java; it offers you a lot of tricks. However, I find those tricks can make maintenance difficult. And then there's Java doc, which helps with the Sun libraries and your own old code. C# has nothing quite like it.

I did a big hairy game in Java and found the language perfect, but my graphics were elementary and it wasn't a shooter where a tenth of a second was an eternity to the players. Also, I expect to add a lot on to it later, whereas I think most people just go and write a brand new game.


You should do it in the language you know best until you can afford a formal education (Bachelor's of Science?) in Computer Science, emphasizing game design. You could possibly use your game to get a scholarship, especially if you can say "I did this without any formal training in Java"

Modern JVMs, even the one from Oracle, have many, many features to address the concerns people have brought up here. You can use different garbage collectors to get more deterministic garbage collector behavior. I don't have extensive experience with the 3D libraries - only a little with Java3D - but nobody here seems to have complained about them. Escape analysis now allows lock elision and much faster/negligible allocation of very short-lived objects.

The problem is, whether you choose Java of C++, you'll have to learn how to properly use concurrency and have a good understanding of memory management. After all, you can just as easily screw up with malloc as you can with new. I don't know what the tools are like for C++, but the profiling tools for Java are fairly easy to use, free, and integrated with the IDE. You can use them to track down performance problems and learn.

  • 6
    \$\begingroup\$ Formal education in CS is worth jack shit for actual programming skills in any discipline. I would know, I'm in my third year. \$\endgroup\$
    – DeadMG
    Commented Mar 15, 2012 at 0:00
  • 4
    \$\begingroup\$ Definitely disagree with DeadMG. Having graduated and picked courses I like, CS took my game development powers from 10% to 100%. It didn't teach me UI, iconography, etc. but actual, real coding. \$\endgroup\$
    – ashes999
    Commented Mar 15, 2012 at 12:00
  • 2
    \$\begingroup\$ @ashes999: Then you got lucky. My course is worthless and I know that there are many others who feel the same. \$\endgroup\$
    – DeadMG
    Commented Mar 19, 2012 at 14:49
  • 2
    \$\begingroup\$ @DeadMG it's hard to see when you're studying. Once you work a couple of years F/T, and learn other complimentary skills, you'll see. I did. But maybe I just paid a lot of attention and tried to apply everything to my game dev hobby. \$\endgroup\$
    – ashes999
    Commented Mar 19, 2012 at 18:17
  • 1
    \$\begingroup\$ I'd say that it depends on the school and the professor. I had a few great programming classes where I learned a ton; and I had a few where I actually felt I lost knowledge by attending. It's all on having a good professor or not. IMO. \$\endgroup\$
    – Nate
    Commented Mar 30, 2012 at 14:48

Not the answer you're looking for? Browse other questions tagged .