I hear a lot of people speak poorly of Java, especially the ones coming from C/C++. Is there a historical reason why? Is it because it used to be machines were too slow to run the JVM without lag?

closed as not constructive by BЈовић, Kilian Foth, Morons, Jalayn, yannis Sep 27 '12 at 7:17

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    In many cases where you'd use C or C++(for example to implement libraries, interpreters/compilers, performance critical stuff, ...) you just can't use Java. Java simply is not built for that, and as such it's limiting in many ways. It's inferior on those domains. Yet, you can use C and C++ almost exactly where you can use Java, with more freedom and usually with better performance. It's much less about "running JVM without lag" than with the fact that without JVM the code would(in many cases) run even faster and for example battery life would be far better. – zxcdw Sep 27 '12 at 7:12
  • 1
    btw it's "bad rep" as in bad reputation – ratchet freak Sep 27 '12 at 10:33
  • 1
    @ratchetfreak actually it's bad rap. shadesbreath.hubpages.com/hub/Is-it-Bad-Rap-or-Bad-Wrap – user66282 Sep 27 '12 at 20:50
  • It was amazing to me who learned C++ as the first OO language and hearing all this bad stuff about OO that just wasn't true. When I learned Java late I ended up discovering every bad thing I had heard about OO was true of Java. Basically as the first large scale experiment in managed OO languages it made some pretty horrific mistakes. Some of them have been fixed while others still haunt us. – Joshua Sep 11 '16 at 20:15

For every language you will find People who Speak poorly of it. It's just the way it is.

Java is no exception.

  • 1
    You don't think the large number of people who speak poorly of Java is anything but a random occurrence? – user66282 Sep 27 '12 at 7:51
  • 7
    @Celeritas There's a large number of people who speak poorly of <insert language here>. – yannis Sep 27 '12 at 7:53
  • 1
    Java seems to get more than other languages. For example people seldom trash talk C/C++ but Java gets it all the time. – user66282 Sep 27 '12 at 7:56
  • 1
    @Giorgio Fully agree on all your points, and will close this with the immortal words of Bjarne Stroustrup: There are only two kinds of languages: the ones people complain about and the ones nobody uses... – yannis Sep 28 '12 at 10:09
  • 1
    I think Java does have an exception with how much people don't like it. I don't think they hate the language so much, just the implementation, and I'm right there with them. And it's not just for that reason I don't program in it, it's also for that reason I don't let Java applications even reside in my computer, they're so horribly slow. – MasterMastic Apr 30 '14 at 22:35

Programmers from the 'real programmers code in binary' clan will probably hate Java till the end of time. But for the rest of us, Java helps get the job done fast and with a (slightly) shorter learning curve.

The C/C++ times gave good programmers the fun of being able to play with memory the way they wished. Java made garbage collection automatic, so that fun was lost. Also those languages compiled to machine code, and so was statistically faster because of the absence of the JVM process. But times have changed and with today's hardware this is hardly even noticeable (unless you're trying to encode video or something). Also, i must say, there is a certain added satisfaction when you pull something off (non-trivial) in C/C++ where-in you had to do all the memory management etc the hard way.

  • 2
    I'll add to this that the runtime compilation that the JVM provides (incredibly powerful BTW) also changed the world for those folks. Suddenly there wasas black box compiler doing 'magic stuff' – Martijn Verburg Sep 27 '12 at 7:00
  • 1
    The performance penalty for non-hardcore Java is often far from "hardly noticeable", but it might be within an acceptable range. – Joris Timmermans Sep 27 '12 at 7:15
  • 2
    True. Poorly thought out code will perform poorly regardlessof the language. – techfoobar Sep 27 '12 at 7:17
  • 5
    I'm a fully paid up member of the "real programmers code in binary" clan but still like Java for what it is good for - general purpose, statically typed, easily maintainable OOP code. While manual memory management can be fun and/or useful in some special cases, it is usually a waste of your time and effort. Use the right tool for the job! – mikera Sep 27 '12 at 8:03
  • 1
    I mostly work with Java. I'm extremely amazed on how terrible programs people can write in Java. So there is no need for a low level language to produce high level of bad software. – dbalakirev Sep 27 '12 at 14:40

Generally speaking Java gets a bad rap because it's essentially relatively weak at both of it's touted strong points:

  • "Java is write once, deploy everywhere": Larger programs generally don't work flawlessly across multiple platforms without additional work. EDIT -- After some research it seems that this has actually improved quite a bit since the last time I seriously used Java (good on Java!) - articles I can find are from the 90s ( http://www.mactech.com/articles/mactech/Vol.14/14.05/WritingJavaCross-Platform/index.html ). A non-Java specific issue that may be erroneously called a Java flaw is that different platforms often just have completely different UI paradigms (e.g. mouse vs. touch, keyboard or no keyboard), and it's just downright difficult to design an application that actually works well on all possible platforms through no fault of the language.
  • "Java hides a lot of things that you don't have to know": Larger programs often require additional deep knowledge of how the language and VM work to tweak things to make them work fast enough for real use (there's a whole page dedicated to it here: http://www.javaperformancetuning.com/tips/) . This can actually cut the other way theoretically as well - a JIT-compiled Java program and/or an updated VM can have hardware-specific optimizations that weren't available at the original time of writing the program (see e.g. http://en.wikipedia.org/wiki/Java_performance#Program_speed).

There is no inherent fatal flaw with Java except that it's really not much better at anything than other languages.

However, it DOES have an impressive collection of libraries available across platforms, and it's disingenuous to consider the language only without the libraries. As a tool to "get the job done" it's VERY general purpose "out of the box" to cover a lot of bases more than well enough for real-world usage. It's an advanced swiss army knife, if you will (one with a lot of safety features to avoid hurting yourself).

C++ developers specifically may have a dislike for Java for some other reasons as well:

  • Java enforces object orientation, and "everything is an object" - multi-paradigm C++ developers are often allergic to being limited in that way (full disclosure: I'm one of that type of C++ developers :)).
  • As mentioned above, a hardcore Java developer needs to know the internals as well to get the maximum out of things (as is always the case, in any language), and a C++ developer is used to actually having access to those internals, so they feel (rightly or wrongly) that they might as well work close to the metal if they have to know it anyway.
  • 1
    I don't think the linked article in the first bullet supports your argument. It points out that Java UIs using Swing actually do work out of the box on most systems. The rest of the article is about how to customise Java to use platform specific features where available (which obviously aren't themselves cross platform, but that is a deliberate choice of the author). – mikera Sep 27 '12 at 8:11
  • @mikera -thanks. I've edited the answer a bit to make sure I don't leave too much "wrongness", though I'm almost certain that this whole question will get deleted in a while. – Joris Timmermans Sep 27 '12 at 9:01

From the end-user point of view, many older Java programs (actually the JVM) used humongous amounts of memory for the simplest of programs. Often well over 100 MB for a simple FTP client or similar. Especially during times when most systems had 256 MB to 512 MB of RAM, that was simply unacceptable. And as Java programs were quite common in the desktop area, many people came to the same conclusion about memory usage.

Also, the Java Runtime Environment has a long history for severe security issues (even right now), so the reputation has dropped quite sharply with the increasing use of Java in general public.

Java Security Alerts:

http://www.oracle.com/technetwork/topics/security/alerts-086861.html#SecurityAlerts (2009 - 2012) http://www.oracle.com/technetwork/topics/security/beaarchive-159946.html (2006 - 2009) http://www.oracle.com/technetwork/topics/security/alertsarchive-101846.html (pre-2006)

Security Alerts

Oracle will issue Security Alerts for vulnerability fixes deemed too critical to wait for distribution in the next Critical Patch Update.

To me, the size of those lists is just horrendous.

  • Azureus, the torrent client, used to eat all the free RAM of my machine back in 2003. That is, over 100 MB out of 128 MB on a Windows Me installation. Awesome! Thanks, Java! – zxcdw Sep 27 '12 at 7:36
  • What security issues do you refer to? – user66282 Sep 27 '12 at 7:53
  • 5
    -1 Java security over the years has been much better than any of the generally available alternatives. ActiveX? Downloaded Windows .exes? Flash? – mikera Sep 27 '12 at 8:15
  • 1
    It is no excuse to have vulnerabilities if other technologies have too. The OP asked why Java has a bad reputation, and the size of the Security Alerts (added to my post) list is one likely reason for Java's bad reputation. As for semantics, reputation and truth do not necessary go hand in hand. – Juha Untinen Sep 27 '12 at 8:44
  • @mikera, It only takes one hole to let the worm in. – Pacerier Jun 25 '14 at 2:58