Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

As a professional Java programmer, I've been trying to understand - why the hate toward Java for modern web applications?

I've noticed a trend that out of modern day web startups, a relatively small percentage of them appears to be using Java (compared to Java's overall popularity). When I've asked a few about this, I've typically received a response like, "I hate Java with a passion." But no one really seems to be able to give a definitive answer.

I've also heard this same web startup community refer negatively to Java developers - more or less implying that they are slow, not creative, old.

As a result, I've spent time working to pick up Ruby/Rails, basically to find out what I'm missing. But I can't help thinking to myself, "I could do this much faster if I were using Java," primarily due to my relative experience levels.

But also because I haven't seen anything critical "missing" from Java, preventing me from building the same application.

Which brings me to my question(s):

Why is Java not being used in modern web applications?

  • Is it a weakness of the language?

  • Is it an unfair stereotype of Java because it's been around so long (it's been unfairly associated with its older technologies, and doesn't receive recognition for its "modern" capabilities)?

  • Is the negative stereotype of Java developers too strong? (Java is just no longer "cool")

  • Are applications written in other languages really faster to build, easier to maintain, and do they perform better?

  • Is Java only used by big companies who are too slow to adapt to a new language?

share|improve this question

closed as not constructive by Jarrod Roberson, Walter, ChrisF Jun 12 '12 at 13:38

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.

113  
I think you're incorrect: it is still used, it's just lost cool factor. –  user4051 Aug 18 '11 at 14:43
36  
@Graham Lee: Java has ever been cool? I must've missed something. Well, I guess it's cold coffee, but cool? I think the main reason is that java, especially the enterprise java frameworks have been and still are heavily overengineered. You can't consider them lightweight, you just use them because you need the distribution/balancing/scalability features of the platform and want to use a framework for the frontend that is done with java, too, for the sake of homogeneity. –  Falcon Aug 18 '11 at 14:57
19  
Maybe, because it's not modern? :P And Java never was cool, simply because it threw the hacking part out of programming. –  back2dos Aug 18 '11 at 15:25
25  
@Falcon Java was cool back when it was first introduced, Sun did a great job hyping Java, whether the hype was justified or not has nothing to do with it being cool or not, a lot of cool things are hyped for no reason. –  Mahmoud Hossam Aug 18 '11 at 15:40
10  
@Falcon, you should have a look at creating web applications with JSF 2.0 in Java EE 6 and compare it to your experiences. You may be pleasantly surprised. –  user1249 Aug 18 '11 at 17:10

39 Answers 39

up vote 116 down vote accepted

Modern day startups need to hit the market as soon as possible. They don't need to spend about six months in order to release their Java web application.

Twitter for example was built using Rails/Ruby but once it became unscalable, they migrated to the JVM.

Not to mention that the development process isn't productive: code -> compile -> deploy while it is in frameworks like (Rails/Django/Grails): run testing server -> code -> change things and see what happens.

The good news is that JRebel lets you see code changes instantly.

share|improve this answer
66  
Play Framework is also like Ruby on Rails, but for Java. Code -> update your browser. –  Jonas Aug 18 '11 at 16:15
12  
@Jonas Man you are commenting on every question about Play! framework :) –  Chiron Aug 18 '11 at 16:16
26  
Just try to get rid of some misconceptions. Java EE is not the only thing on the Java server side as many seem to think. –  Jonas Aug 18 '11 at 16:19
14  
Facebook also does something similar. Their code base is in PHP, but because of speed and scalability problems, they had to write a compiler (HipHop) that compiled the PHP to C++, which is then compiled using g++. It's funny how everybody talks about how great ruby and PHP are and that all the sites are built around them, but then when you look at how inefficient they are, most large organizations have to switch to something else. If I recall correctly, Craigs List hasa lot of backend code written in C/C++ for this very reason. –  Kibbee Aug 19 '11 at 13:24
19  
1) Using Eclipse, compilation happens as you type and you will rarely notice. Also, running Tomcat within Eclipse I can restart an app in under a second. I'm rarely hindered by restarting my apps 2) There's no silver bullet, guys. Ruby or any language doesn't make you 10x faster. The problem with Java dev is often ramp up time, but if you know what you are doing, you can get working in a project in <10 min. –  alex Dec 14 '11 at 22:41

In my experience, Java for web applications is overkill for small applications. A simple blog with one database table hold blog entries, for example, could be done in something much simpler.

I have usually seen Java do much better in much larger web applications (think banks and insurance companies) that communicate with a number of other systems (such as mainframe back-ends and databases and peer web-services background batch-processing systems... all in the same application).

From what I've seen, the architecture of a JavaEE web application is just usually more than is needed for small/simple web applications.

share|improve this answer
3  
For "small" applications, this is even more true if you have to (because this is the "standard" and the company uses it) work with monster application servers such as Websphere, whereas more often than not Tomcat for example is good enough... Why oh why do I have to work with that messed up administration console ? Sigh... –  Jalayn Aug 18 '11 at 14:53
3  
@Jalayn: In my experience it's because they only want to maintain one application server program for everything, rather than admin WebSphere for Team A, Tomcat for Team B, Glassfish (or something else) for Team C... and I can understand that feeling too, but yes, it's frustrating to me as well. –  FrustratedWithFormsDesigner Aug 18 '11 at 15:00
2  
This is true for Java EE, but now there is Play Framework that will make your Java web apps as lightweight and productive as Ruby on Rails. –  Jonas Aug 18 '11 at 15:38
8  
The new Java 6 EE - especially the web profile - allows for some pretty simple webapps. –  user1249 Aug 18 '11 at 17:00
2  
@ThorbjørnRavnAndersen The app might be simple, but understanding the framework isn't, and neither is understanding the main tools like Ant or Maven. A newbie's learning curve is huge and full of nested layers of acronym soup, confusion between specs (eg JAX-RS) and impls (eg Jackson) and more. It's IMMENSELY complicated to do something simple if you want to actually understand what you are doing. –  Craig Ringer Jun 11 '12 at 1:19

Start Ups want the shiny. Whatever the shiny is: RoR, Groovy, Grails, OOP w/ PHP, Foobar, Wibble, Narf, etc.

Enterprise wants stable, reliable and scalable: Java and .NET fit that bill (when done correctly).

Current gig: Financial Services. Platform: ColdFusion (essentially a Java Tag Library) and Java.

Previous gigs:

  1. Education Testing Services - ColdFusion
  2. High Risk Insurance - ColdFusion and Java
  3. 401k - ColdFusion and Java
  4. Travel - Java w/ internal ColdFusion apps
  5. Securities - ColdFusion (pre-Java version)

These are all high-volume, high-security sites. No one at any of these companies ever considered PHP, some looked at RoR and saw too many issues. The 401k company had a sister company running a .NET application with competent developers, the app just kept crashing every week. They finally converted it to Java and gained stability.

The only people that look down on Java are those who have no or little actual experience with it or have been involved with poor implementations and are now gun shy. They see the shiny and figure if all the cool kids are using it, why not me?

share|improve this answer
11  
"The 401k company had a sister company running a .NET application with competent developers, the app just kept crashing every week. They finally converted it to Java and gained stability." Lol :), have heard of the opposite case. –  Den Aug 24 '11 at 8:58
8  
Well of course you have. There's more to web applications than writing code, you have to know how to tune your servers, write optimal SQL and so on. That company had 2 .NET devs and no real server admins. The company that bought the company I was with also got that app in the deal. They were a massive Java shop and therefore had more resources available to guarantee stability. –  Adrian J. Moreno Aug 24 '11 at 18:45
33  
It seems disingenuous to me that you've written that sentence stated as cause and effect. Convert to Java = stability gain? We all know that's not why. Also, sorry about all that ColdFusion experience ;) –  Jordan Aug 25 '11 at 7:28
3  
Too be fair, investors tend to want to see the flavor of the year. But I still personally can't think of a worse choice for rapid prototype development barring very-high-quality Java devs which are not easy to find. –  Erik Reppen Jun 12 '13 at 21:28
5  
very-high-quality Java devs which are not easy to find - Indeed. –  luis.espinal Aug 3 '13 at 15:57

An addition to the FrustratedWithFormsDesigner's answer: Since I guess that your question more targets towards smaller sites, there is an important aspect that you need to consider for a lot of people: Hosting is ubiquitous for PHP but its harder for Java or ASP sites. This however is not a defect of those languages.

share|improve this answer
7  
+1 for this. It's far easier to host many sites on a server for PHP than it is for Java and added to that it is far easier to find cheap web hosting solutions for PHP than for Java. –  Jonas Aug 18 '11 at 15:43
1  
@Kibbee - Arvixe That is who I use. I have the personalASP Pro plan. –  Jetti Aug 19 '11 at 13:45

Java absolutely is used for modern web application development. Particularly once you get to the slighly larger / more complex / scalable end of the web application spectrum.

If you are interested in modern, productive tools and frameworks take a look at:

But I think most truly modern web development on the JVM platform is likely to be done in one of the new JVM languages rather than using Java directly, with Java simply providing the backbone in terms of underlying libraries and back-end infrastructure. There is a lot of web development happening in Groovy (Grails), Scala (Lift), JRuby (JRuby on Rails) and Clojure (Noir, Ring/Enlive+lots of custom frameworks) to name but a few.

With all the innovation happening the new JVM language space, I personally suspect that Java will ultimately become the "assembler of server-side programming".

share|improve this answer
6  
Agreed; Java EE 6 is great as soon as you drop JSF2 and use something sane and productive. The learning curve is still immense though. –  Craig Ringer Jun 11 '12 at 1:22
1  
You could add Tapestry5 (tapestry.apache.org) to your list of modern Java web frameworks. –  Neeme Praks Jun 12 '12 at 10:09

I programmed java web apps for 10 years before I switched to python, 4+ years ago. I feel that I'm much more productive using python and can get much more done in a shorter period of time, and to be honest, I'm much happier when I develop in python. Here are some of the reasons why I think python is better then Java based on my personal experience, your milage may very.

Web Frameworks:

When I first start programming web apps in Java, Struts just came out, and it wasn't great, but it was the best thing available. I created a bunch of struts apps, and a few in other frameworks along the way. Whenever a new framework came out (Tapestry, Wicket, GWT, stripe, grails, AppFuse, Play, RichFaces, Spring, etc), I would try it out and see if it was any better, and most times it was only a little better, and sometimes not better at all. I do have to say the play framework is a step in the right direction.

Batteries not included:

One of the most annoying parts of Java was the fact that most of the libraries that you use were not included in java itself, you had to include a ton of 3rd party libs from places like apache commons. If you use something like hibernate with any other large library, you end up in Jar dependency hell, where hibernate needs one version of a jar, and something else needs another version. If you load the jar files in the wrong order, you are out of luck. You need to depend on tools like maven, and ivy to manage your dependencies, and this just brings in more dependencies into your project which results in projects being huge. I had some war files 100MB+ war files for the simplest web apps.

Too many options:

For some reason there seems to be way too many different ways to do the same thing in Java. There are over 38 different web frameworks for java according to wikipedia ( http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks#Java ) and 23 different ORM's ( http://en.wikipedia.org/wiki/List_of_object-relational_mapping_software#Java ) just to name a couple of examples. If you look at other languages they have a more reasonable number. Some people think that having lots of options is a good thing, but it isn't it leads to a lot of wasted effort in the developer community, everyone is reinventing the same wheel, and if you are a new person to the language you have too many option to pick from.

App servers:

Java web applications are really heavy, and require a lot of resources to run. They are especially memory hungry. Like any piece of software they can be tuned to reduce their resource footprint, but compared to other languages their out of the box setup is horrible. In my past I have used weblogic, websphere, Jboss, tomcat, and jetty. I only used the first three when I was forced to use EJB's, but even if you aren't using EJB's they were large app servers and sometimes hard to configure and get running correctly. Tomcat and Jetty are much better and easier to setup, but are still resource hogs.

App Hosting:

If you aren't running your own server it is real hard to find shared hosting for your java apps at a reasonable price. The main reason is because java apps require much more memory compared to other languages, so it doesn't make sense for a shared hosting provider to spend their valuable RAM running a java site, when they could run 5 php sites in the same place. That means there are less providers offering java hosting, which in turn means higher costs to run your website.

Development Time:

When I developing in java, I found myself much slower then what I can do in python. I would need to make a change, compile, redeploy and then test, and this slows down the iterative process. I know there are ways to make this faster, but even at it's best, I felt much slower then what I can do in python.

There is also a lot less boilerplate code to do the same thing in python, so I spend less time developing the code as well.

Java just feels over engineered in a lot of parts, A lot of the API's and interfaces are just way to complicated for what you want to do. And everyone and their brother thinks they are a java architect and this results in big complicated systems that are hard to use and develop with.

IDE:

When I was developing in Java, I felt stuck to the IDE, I was lost without it. IntelliJ is the best IDE's on the market, and it was hard switching to python because there wasn't anything like it for python. So instead of an IDE, I just used textmate, which is just a normal text editor. It was hard at first, but because it was just a text editor, it was a really fast and responsive application. I could open my whole project in a few seconds, whereas when I want to open a project in an IDE it could take a minute or more, with a machine with a ton of RAM. The makers of IntelliJ came out with a python editor called pycharm, I bought it when it first came out, and it is great. But what I realized is that I don't need an IDE for python, I'm fine with a text editor. When I go back to working on Java web apps which I have to do from time to time, I try to use the text editor, but I haven't quite mastered that yet. I personally need the IDE for Java more because If I mess up something it takes longer to recompile and redeploy, which slows me down.

ORM:

When I first started using Hibernate as an ORM, I thought it was great, it had it's problems, and it wasn't perfect, but it was better then what I was doing before. I was happy with it, until I did an application with Django's ORM on a python project, and that opened up my eyes, that is how an ORM is suppose to work. After that project I went back to hibernate, and I just felt disappointed, and longed for going back to Django's ORM. Another great python ORM is sqlalchemy, which is similar to Django's ORM, but a little different. I have limited experience with ROR's ORM, but from what I remember, it was pretty good as well.

Templates:

The web templating systems in Java aren't that good, and I think I have tried them all (tiles, freemarker, velocity, etc). Most of them offer only basic functionality and are a pain to work with. On the Python side, my two favorites are Django templates and Jinja2, they have everything that I could need in a templating engine, and are really easy to use.

share|improve this answer
3  
I'm with you on many points, but take issue with some. Compile/test loop: Use Eclipse's dynamic web module, and/or JRebel, and it's gone; great. Heavyness: JBoss AS 7 is pretty light and fast. and if you don't want EE you can use Tomcat or Jetty which are barely even there. Testing: Arquillian is the best test tool I've used in ANY language, though it's only just become mature enough to be usable. Dependency hell: Just use Maven; it should be standard and mandated part of JAva. –  Craig Ringer Jun 11 '12 at 1:29
1  
I also think you missed a critical point: The learning curve and bugs really slow things down. –  Craig Ringer Jun 11 '12 at 1:31
1  
+100000000 you nailed it. –  cbmeeks Jun 3 at 19:18

Well, I recently met with a Java guy that was really excited by the new Spring Data project, because of how little code it takes to get basic CRUD access to your DB going.

I can build a CRUD app using Rails (not just db access, but views and controllers) with a few commands.

(Off the top of my head: new project, 1 scaffold command per entity, 1 command to migrate the database, 1 command to start the server.)

It has nothing to do with the language, it's all about the tools. And it seems that dynamic languages tend to have the tools and frameworks that remove a lot of boilerplate code. (To make up for our lack of powerful IDEs that generate boilerplate for us.)

Also I feel that dynamic languages tend to make writing such tools and frameworks a lot easier. I can grok the code for say, Padrino or Rails (ruby web frameworks) a lot more easily than I can grok the code for say Spring Roo. This could be due to the fact that I know Ruby a lot better than I know Java, though.

share|improve this answer
18  
Personally I don't like dynamic languages. Static languages make me more productive when I can see all type errors fast in my IDE and use refactoring tools. You should have a look on Play Framework it's a Java web framework inspired by Ruby on Rails and makes you productive with Java. –  Jonas Aug 18 '11 at 15:46
4  
An powerful framework, like rails also means that if something is bad implemented then most people can't replace it by something else, because that component is too tight with the framework. While for java, if I don't like Hibernate, I can use something else like cayenne or JPA for example. –  Coyote21 Feb 2 '12 at 13:14
2  
As someone fighting Django, allow me to just say: Coyote21 is absolutely right. You can get basic CRUD up and going in five minutes, but the second you start adding business logic (when this record is updated, a record must be inserted in this table, and...) to the CRUD, you've got issues. –  syrion Mar 25 '12 at 12:45

Java has been positioned in the recent years to be "enterprise". Which is on the other side of the spectrum of what a startup needs. In web application development you need 4 things - painless database access, great string manipulation, syntax sugar and rapid iterative process to make the numerous little changes your app requires.

Performance,scalability and stability are a bit lower on the priority list.

Also Java is very unfun language to code in. It got the revolutionary ability to use string in a switch statement just yesterday. And javascript is very hackerish language so after developing your frontend you feel very constraint when you return to java.

So I suppose these are the reasons webstartups avoid java.

share|improve this answer
9  
painless db access? Spring JDBC or Hibernate work great. Great string manipulation? Don't think string manipulation is much more than 5% in any project. Syntax sugar? What do you even mean by that. Rapid iterative process? Java has it (Tomcat inside Eclipse is painless). Java unfun? Only thing missing is concise anonymous classes/lambdas/etc. The "fun" features in other languages tend to obfuscate and make things less clear. Strings in switch... yeah, I gotta admit that sucks (however, most of the time, you should be using enums). –  alex Dec 14 '11 at 22:46
3  
@alex: Syntax sugar Java practically cannot be used for DSL, for example, Play's config and routes file aren't Java file, it's in a foreign syntax which does less than say django's settings.py and urls.py; no list comprehensions; crucial datatypes (e.g. maps, lists) are not imported by default; idiotic one-class-per-file really gets in the way; and Java APIs tend to be unnecessarily verbose. Also, you can't use enums when you're switching between strings you received from GET/POST parameter. –  Lie Ryan Jun 11 '12 at 2:19
1  
@alex Interesting. I tend to use generics everywhere in C# - although looking at it from the outside, that's probably due to the increased functionality of lamdas - So I can have an IRepository<T> with an IQueryable<T> Where(Expression<Func<T, Boolean> Expression). I wonder if they'll become more popular in Java when it gets lambdas? It's probably a comfort zone thing but Java just feels verbose - and very much like I've been handed enough bits to build 50 different types of car with no guarantee any 2 parts will fit together. –  Basic Mar 7 '13 at 22:31
1  
I can't believe that two people have argued that Tomat inside Eclipse is painless and makes Java development efficient. I find that it makes each development cycle much quicker, but requires daily maintenance, including repeatedly refreshing, rebuilding, cleaning tomcat, redeploying, restarting and sometimes restart Eclipse and repeating the earlier steps. If my car needed that much maintenance, I'd never get to work. –  Brandon Mar 20 '13 at 12:40
1  
@Brandon I will second that. I have never, not once struggled with a config issue in Node or Python/Django. I lose patience with RoR. Our Ant/Mvn/Spring/Hibernate/eclipse dependency-ridden Java codebase is a waking nightmare before you even get to the code. –  Erik Reppen Jun 12 '13 at 19:37

Does Google, Amazon, or LinkedIn count as modern?

Java is used for modern web applications. If you look across the enterprise it is the most heavily used language for web applications (internal).

That said, Java went through a period were it's web development standards tried to be everything to everyone (arguably still do). "Don't repeat yourself" was a response to the xml hell and long build cycles of Java web development. As a result, Java (EJB, Struts, JSF, etc) became seen as the thing all of the new paradigms were trying to overcome.

Java, the language is verbose. That is a pro and a con (great for maintenance, sucks for dev). There are a number of modern language features that have not yet made it into Java that can cut coding time down substantially (properties, events, closures, generators, list comprehension, etc). So, it can be frustrating when coming from a more modern language. That said, they are difficult to add in to a mature language without becoming the rats nest that C# is becoming.

Many languages used in modern web development are dynamically typed. This enables tooling that can dynamically reload code as it is written (this is harder to accomplish in a static language - jrebel). Since web development lends itself to fast iterations, dynamic reloading is a huge win. It significantly reduces the development cycle on greenfield projects and makes it easier to get the UI and the UX right (trial and error by nature).

Static languages have their place, too. For backend logic that is complex, must run for years, must scale without issue, must be very fast, and must be completely error free, statically typed languages (like Java or even C) are preferred.

Additionally, as developer count/turnover grows and products mature the likelihood of well intentioned folks introducing bugs skyrockets. The rigor and discipline that a well designed Java project (interfaces, patterns, and holy water for those php vampires :)) enforces helps to reduce long term risk. While, this can also be achieved via unit testing, the safety net derived from static checking (and static analyzers like findbugs and clang) delivers a built in level of code coverage that is hard to replicate with handwritten tests. Don't get me wrong, there should be unit tests and functional tests, but real organizations never achieve 100% coverage. For what they check, static analyzers do.

So, in large projects (as defined more by team size than code size), where there is complex interoperation between independently developed chunks of code, languages like Java are still preferred. Examples include large/complex web applications like those at financial brokers (ameritrade), financial exchanges (nasdaq, nyse, maybe london after the .net failure), online banking (almost all of them), email (google), auction (ebay), etc.

From a performance and scale perspective, nothing tops the Java platform for it's combination of scalability and performance for web applications (depending on how you count facebook's application partitioning). Twitter, for example, had to rewrite large portions of it's Ruby infrastructure in Scala on the Java VM in order to put the fail whale back out to sea. I've heard of other large examples, but they elude me right now.

It’s also worth considering security. While Java browser plugins have suffered their fair share of security vulnerabilities, the java platform itself is one of the more secure platforms created. Java web applications have a reputation of being very secure. It’s coding practices, libraries, and architecture have long discouraged mistakes that make attacks like sql injection or buffer overflows possible. While other web platforms(rails) have a good security reputation, none surpass Java.

Bottom line, most web applications are simple technically. For simple, Java is often overkill (just like in the old days when we wrote them in C :)). If, though, the webapp is complex (backend or otherwise) or is expected to have 100+ developers, Java is hard to beat.

--

On a personal note, I use Grails a lot because it gives me the best of both worlds (the same can be said of JRuby which I hear is becoming more and more popular in the Ruby world).

BTW - I find the rise of PHP to be truly baffling. PHP as a language is the rough equivalent to perl in readability and VB in the quality of the results. It encourages horrible practices, is next to impossible to maintain, 3rd party libraries rarely work as expected, and it has a syntax that would drive Larry Wall up...well...a wall. The only explanation I can conjure is that it lends itself to incremental learning (like VB). In other words, you can accomplish something useful knowing very little about programming/administration and you can extend your knowledge a small chunk at a time. There is a lot to be said for that from an adoption perspective. However, for anyone that has every had to support or replace one of the billions of VB apps that were written by "programmers" in the corporate/mfg world, you are probably shaking your head and planning your retirement. :)

share|improve this answer

I currently work in a company which has quite a few "I hate Java" Developers. It used to stun me too. I certainly hate all the hoards of technologies that are available with Java. This makes taking decisions too difficult. Its like When you have too much choice you have no choice. You have to spend time with 100's of frameworks to really come up with the framework that works for you. The standard Servelt architecture is waayy to complicated for most applications. This is not the case with Ruby, Django and stuff. They are are more of a single framework rather than language.

The biggest complaints I hear from developers

  1. The Syntax is too long. Just to print something we have to write System.out.print. You cant really use a simple VI like editor and write out a working piece of code in a few hours.
  2. Weak test frameworks. Even though the testing frameworks are very similar in Java and Ruby, Ruby takes a step forward by making thing easily available for testing. This is especially true if you are using DB extensively in your application. Even many of the Web frameworks dont think about testing.
  3. Templates are a pain. Makes the relatively simple language into a Noodle Soup.
  4. Not Cool. Most Java applications are written in huge companies, which is associated with Bureaucracy that does not go so well with developers. People don't think Google when they think Java. Google == Python. It has also to do a lot with no books coming out indicating do X in Y days.
  5. Dont like to compile. To most developers compilation is a decade old phenomenon. It made sense in 80's with C but mordern computers can do a lot more. They dont write code in compiled languages. Java is one of the very few languages that is compiled and used to write web applications.
  6. Too many Oops Concepts. Even though developers have quietly adopted the Oops domain. They dont like it in full. They dont like when you write an application with 10 classes with each class doing just one thing. Makes you open 100's of files and imagine interaction across 100's of classes, sometimes with frameworks. Makes the whole programming activity a chore. This could be true with most languages but I have seen that Java Developers pay a lot of attention to what a class does. Its the Java Developers who often come up with a code with 100's of classes. This is good from many perspectives but non java developers hate it.

So all in all Java imposes a steep curve at the beginning of the project, which means too much money to be committed. Add to this a huge community attached to java, each thinking in different ways and no one to really spear head the whole community. They also dont see talks and conferences conducted by the community showing off all the cool new things. No new cool books. Java it looks like will go down because it was used to solve too many different problems a few years back.

share|improve this answer
2  
I love OOP. I also know OOP which is why I would disagree that the vast majority of Java devs are doing too much of it. You can write a class but if your code is still a tangled spaghetti mess, all your really did was find a way (beans) to write crap procedural code with pointless structures wrapped around what might as well be simple functions or structs at best. –  Erik Reppen Dec 7 '12 at 1:13

In a recent interview with, Joseph Snarr, a technical lead for google plus explained how the application uses Java Servlets for the back end and JavaScript on the front end.

So to answer your question Java is still used for very modern web development. Just not for the start-ups that have been getting so much press recently.

I think the reason that a lot of the start-ups are using other technologies is because theyre sexier and have a more publicized an open source push behind them.

share|improve this answer
1  
Start-ups use other technologies because they want to get it done now. Not later. And they went it to get done now by like 3 people, not 30. –  Erik Reppen Dec 7 '12 at 1:17

My team and I are currently developing a greenfield web application in Java 6 + Stripes. Within the last year I also worked on another greenfield web application using Java 6 + Stapler (a somewhat unknown web framework developed by Kohsuke Kawaguchi of Hudson/Jenkins fame).

Java is absolutely used for modern web development. Certainly it doesn't have the "sexy" appeal of Ruby or other dynamic languages, but I'm far from convinced that dynamic languages are a good thing once a project starts to scale.

Modern Java app servers are very competitive with ASP.NET in terms of performance, and both are orders of magnitude faster than any dynamic language VM I know of.

Don't get me wrong... I'm not saying Java is always the best choice (not remotely!) -- but neither is it always a wrong or "outdated" choice.

share|improve this answer
1  
I tend to disagree with the "faster". In theory they should be but there are some massive php sites out there and nearly all the anecdotes about performance problems relate to MySQql or other underlying databases. On the other hand almost every J2EE app I have come on contact with needed extensive tuning before performance was even acceptable. –  James Anderson Aug 19 '11 at 4:23
1  
@James: do you have anything besides vague anecdotes to back that up? All the top-10 websites out there are either running on managed platforms (Amazon on Java, Twitter on Scala IIRC, Google on a custom backend of Java and C++) or else they have a highly customized infrastructure (Facebook and Wikipedia use PHP, but they both have huge amounts of custom native code for speed). Java regularly outperforms dynamic languages in benchmarks. I'm no Java zealot, but performance is not Java's problem. –  Daniel Pryden Aug 19 '11 at 5:49
1  
@Basic: What is your point? There are lots of broken libraries and frameworks for any language. Yes, there is lots of crufty and out of date documentation -- but that's hardly unusual either. Conversely, there are some fantastic libraries, frameworks, and tools for Java. Are you seriously trying to suggest that there should be one end-to-end framework for every application ever? –  Daniel Pryden Mar 6 '13 at 22:00
1  
@Basic: Backwards from what? In the year and a half since I first wrote this answer, I've moved on and am currently working at Google, and I can assure you that Java is used very heavily for web application development at Google. Of course, Google's needs are very different from the needs of many other companies, but Java is a different beast entirely when you use the right libraries and frameworks -- just check out some of the things Google has open-sourced (Guava, Guice, GWT, Protocol Buffers, etc.). –  Daniel Pryden Mar 6 '13 at 22:11

The frameworks for doing Java web development have quite a bit of learning curve, they're often overkill for what you need, and much of the indirection required to make things work is just...painful...to work with.

I used to work for a company that did Spring/Java development, and I found the framework cumbersome at best. I don't have a lot of pleasant things to say about Spring's framework, except I had a friend who used to do Struts development and he thought Struts was even worse. The web-framework is nothing like doing desktop applications or mobile (eg: android) applications, and has a lot of very abstract ideas that take some time to really grasp (though, certainly, that gives you a lot of power and capability if you're a pro and doing something really complex like an enterprise grade app). I love programming java for mobile or desktop devices, but java for web-apps? Not so much.

I haven't done any programming personally in Ruby/Rails, but my friend who used to do Struts is now doing Ruby web programming and testifies that things that are difficult to do in Java web programming require a lot less code and complexity to achieve in Ruby. There's certainly a learning curve to the different syntax and language rules, but for prototyping apps, it has an advantages in terms of how much code is required to achieve a desired result. As others have mentioned, scalability is an issue to consider as well, and one of the reasons more mature apps are not seen as frequently in more hip languages.

share|improve this answer
1  
+1 for framework. Not only were the original frameworks attempts P**s Poor (JSP, STRUTS), we now have about thirty to choose from not one of which works as well as RoR. –  James Anderson Aug 19 '11 at 4:19

It comes down to costs and trends. The Web 2.0 Startup is created by an under 30 visionary who has more talent than money (I'm generalizing of course but this is what you'll see "on average"). He is going to use a language he is familiar with because he's doing the programming (along with maybe a few friends). He's most likely a self-taught programmer.

Java has been targeted as an enterprise environment (by Java, I mean the language, the framework, and the standards). There are a bunch of expensive tools that the IBM's, Oracles, and BEA's of the world want to sell enterprises.

The steps to become proficient with Java are complex and/or expensive. I know the landscape is changing there but is it too little too late?

After the startup gains traction comes the growth. Recruiting talented developers is difficult. Most "become a programmer in six weeks" programs teach Java (or .NET) and the market is saturated with "six week programmers" (oddly enough I've seen developers with resumes saying 7 years experience that still show the knowledge of a six week programmer). Using a non-mainstream non-"enterprisey" environment can be a natural filter for six week programmers. It takes dedication and personal investment to learn a Ruby or Scala outside of a job requirement. This is the biggest indicator to me of potential for a candidate.

Knowledge comes with experience but a dedicated / passionate programmer will gain knowledge more rapidly (on average) than someone without that dedication / passion. Just like a kid who loves playing guitar will become better more quickly than a kid taking lessons because his dad made him.

share|improve this answer
1  
I don't agree with the paragraph that says: He's most likely a self-taught programmer. This is untrue these days, nowdays most people from 30's that program are competent programmers and have at least a degree. –  Coyote21 Feb 2 '12 at 13:17
1  
??? I'm painting the prototypical web startup. I didn't say anything about them being competent. You can be self-taught and competent at the same time. I'm not sure what you're disagreeing with. –  Mike Brown Feb 2 '12 at 13:25
1  
This was to be my answer. Java is pretty much the only current web technology that isn't designed so that any competent developer can just pick it up and use it. The second part of your answer is pretty much what Paul Graham wrote in The Python Pardox –  user16764 Jun 10 '12 at 13:00

Java is too complicated. I do a ton of PHP work and it's just easier and faster for most situations. The ability to just SSH into a server open a php file make changes save and be done is great. The few Java apps I've worked on have always required a restart for the simplest change. (not saying it's always the case just what I've delt with). Additionally PHP hosting is cheap and readily available.

I also think what you have at least with PHP is a lot of developers who like me started off 14/15 years ago with static HTML. As things progressed we started adding PHP to our sites because it was easy, simple, and affordable. Over the years the language has grown and has expanded it's abilities way beyond it's humble beginnings and now tries hard to be what I think is a lot of things it's really not.

On the flip side most PHP devs I know see Java as this giant overly complex 800lb gorilla, almost like getting out the 18 wheeler semi truck to drive down to the grocery store and get a loaf of bread.

I've tried to learn Java, my first impressions where that it was very long winded and carpal tunnel inducing. Additionally starting off it left me with a lot of questions that probably seem easy to a Java veteran. OpenJDK, or Sun? Tomcat, or Glassfish, or? Plus it seems every intro to Java book starts you out writing code for the command line. I think most people these days find that a snooze fest.

share|improve this answer
2  
I'll take more choices and a little more complexity over PHP's over 9000 built-in methods. –  Kaleb Brasee Aug 19 '11 at 2:54
1  
PHP is just so easy to setup. –  Barfieldmv Aug 19 '11 at 11:22
8  
but it's just makes it so hard to write good code... easier to setup, easier to start, less boring shouldn't be the criteria you use to choose a language. Good programming requires discipline, patience and effort... it's a bad sign if you don't have those while choosing... –  alex Dec 14 '11 at 22:52
  1. Java is more complex to learn than PHP/Python/Ruby
  2. Java ecosystem is very complex, very large and quite confusing to beginners
  3. There are many historically bad frameworks with negative reputations associated with java, you have to know which frameworks to avoid wasting time on
  4. Java build tools are way to complex (maven & ant)
  5. Java does not have a module systems that is easy to use (OSGI is way too complex)
  6. Java IDE such as Eclipse while very powerful with amazing features are difficult to configure for effective web development without lots of experience.
  7. If you are using anything other than Tomcat or Jetty as a server then you will be frustrated by long startup times of WebSphere/WebLogic/JBOSS
  8. Java EE solves problems that many people don't have such as distributed transactions

A new developer getting into professional development will find Java an Order of Magnitude harder than rails, python, or php to get going with so they go with what is easy to learn.

Having said all the above, I made the decision to use Java for my Startup because a properly configured Java Development environment is very productive to work in. By properly configured I mean.

  1. Less than 10 seconds start-up time
  2. Properly configured eclipse workspace, with a all frameworks wrangled up and configured
  3. Good selection of libraries (Spring, Spring MVC, Spring Social, Spring Security, JPA, Hibernate, Velocity, .... etc)
  4. Fast developer machines with SSDs
  5. Orielly Safari subscription
share|improve this answer
7  
Let's be clear though. The language Java, is not hard to learn. It's all the layers of crap built around working with Java to make up for its shortcomings (verbosity, protecting you from yourself and your teammates by being inflexible as all getout, the absurd quantity of libraries relied upon, etc...) that's a PITA to learn. –  Erik Reppen Dec 7 '12 at 1:24
2  
@ErikReppen Very true. I am having to work on a Java project but have a background in .Net. The language and syntax is easy as anything I've come across to understand. It's the verbosity that's really driving me nuts. What I used to in 1 line now takes 5-10 and (often) an XML config file edit. Not to mention that without spending hours upon hours reading, picking the "right" framework for a job is a nightmare - and that's before you find out that your scenario is considered an edge case, isn't supported and if you don't like it, rewrite it. I want to spend my time solving the big problems –  Basic Mar 6 '13 at 17:41

Since you mentioned web development and Java, many people tend to forget that at the beginning using Java Applets in a web browser did not preform well, not only that, but the "sandbox" for the applets were not fully developed and there were security issues with Java Applets being able to run in the browser and access local machine data (aka client side security issue). Sure Java was solid in the backend and stand-alone applications but I think associating Java the language with Java applets (run on the browser) together kinda screwed up some perceptions about Java as a web development component. I don't think they ever recovered from that.

share|improve this answer
9  
Absolutely not! Actually Java is a dominant language in the server side world. Applets extinguished maybe decade ago. –  Chiron Aug 18 '11 at 16:06
5  
Flash did what Applets tried to be. Quick start up, fast download, low memory footprint. –  user1249 Aug 18 '11 at 17:56
4  
I know a lot of people that can't even distinguish between Java and Javascript. Even though they are completely unrelated. This is another thing that gives Java a bad name. –  Kibbee Aug 19 '11 at 13:37
3  
@Kibbee ... or it gives Javascript a bad name :) –  Matthew Schinckel Jun 10 '12 at 12:36

About 5 yrs back, me and a colleague were given a programming task for some internal project. A simple enough task which required command parsing.

I came up with the entire thing in about 80 lines of java code and my colleague took a week, about 20 java classes and much more lines of java code to do the same. Needless to say, his code was picked.

This made me wonder. Everywhere, complexity was appreciated. ( I was working in one of the biggest software products company. ) Java was the tool of choice and design patterns were THE way to code.

Now, is it the mindset or just arrogance that rejects simplicity. Well, I always thought common sense should prevail. Whether it is an enterprise or a simple web application, the basic use cases are the same. It should be correct and verifiable.

I don't use java anymore for several reasons. But one of the factors - complexity, is the prevailing mindset in a ton of java devs when it comes to developing software.

As for scaling dynamic languages, JVM is the result of decades of research. There is a lot of the same happening for Ruby etc.

Scala is one language which I find is extremely clever and practical. Play! with Scala is just as excellent for web/enterprise application development as any out there.

As for Ruby and Rails being the shiny new thing for start-ups, it is extremely difficult to hire a solid Rails developer. It is actually an impediment to any start-up whereas the plethora of java devs should make more business sense.

share|improve this answer

Traditional web applications on Java, though well structured, are very far from "rapidly developed". Though I've only ever written one full web application (Java/Tomcat/Struts), it was extremely picky, took longer than expected to debug, and was generally painful when implementing the business logic layer. In Java's potential defense, it was the only web application I had written in Java (though I'm used to programming systems-level applications in Java), and I believe I could write another web application slightly faster the second time around.

Having said that, I've also written applications in PHP and C#, and they just work better, and are far more forgiving than Java. More than that, Ruby on Rails was written specifically for rapid application development, which, like Robbie said, allow easy CRUD access to databases. The problem is that most web sites you will be developing on your own do not need the level of customization that Java offers (and requires you to perform). Additionally, every DB connection object must be written by hand and isn't that easy to templateize. There may be a better framework around, especially one that takes advantages of Java 7's new dynamic language support features, but I haven't done the research yet.

share|improve this answer
3  
You should have a look on Play Framework it's a Java web framework that make you productive with Java and is inspired by Ruby on Rails. –  Jonas Aug 18 '11 at 15:41
2  
@Jonas, consider writing some good blog postings explaining all this concisely. –  user1249 Aug 18 '11 at 17:01
2  
@Thorbjørn & Brian: See the video on the front page of the play framework website, it explains it very nicely I would say. –  Bjarke Freund-Hansen Aug 19 '11 at 6:52

The question should be "Why isn't Java used by startups or for small projects?". Java certainly used for "modern Web apps". At Google, Java is used on the backend for many services, and closure compiled JS or GWT is used for the frontend. The issue is one of speed vs scale. Startups need to get to minimum viable product. They are usually small teams of 1-3 engineers, and value iteration speed over performance or maintainability. Running up against scalability issues or team code code maintenance issues is a problem "you'd like to have", that is, by the time you reach that stage, it's a sign your initial implementation helped you over the initial hump of getting customers or investment. You can afford to rewrite the app at that point.

A company like Google can afford the luxury of building things for scale up front, even though they may be wasting their time implementing scaling for something that might get no users, because they can absorb the loss.

At least, that's my opinion, that many many "cool", "hip", "modern" companies build small apps with small teams where iteration speed and simplicity are the greatest requirements.

share|improve this answer

Depends how you define "modern web application development". If you are talking startup, fast turnaround websites, you will need to consider languages and frameworks designed for that purpose. If you are looking for stable, scalable, enterprise level web development, you look for languages and frameworks that support those ideals. In my book, those are two very different goals. RoR, Groovy, etc., are good for the first and Java is more appropriate, in general, for the latter.

share|improve this answer

Google App Engine supports Java, so that you can write your entire web app in Java, using Eclipse as the IDE and deployment interface, with a reasonably documented Google API -- so I wouldn't say it isn't used or isn't usable.

share|improve this answer

This is true, but not because of Java and its ecosystem. It's because of people that, when using Java tend to create big messes and heavy abominations.

There are enough frameworks (spring-mvc, grails, play, etc.) that allow you to build things fast. The fact that people overengineer their systems is a problem that comes with the increased knowledge people get when they work with the Java ecosystem - you know many more thing, and you have them available (there are tools for everything), and "everything looks like a nail".

If you are "hacky", you can do pretty much the same with Java as with other languages, and here's a study indicating that:

Study of 49 programmers: static type system had no effect on development time... http://www.cs.washington.edu/education/courses/cse590n/10au/hanenberg-oopsla2010.pdf

share|improve this answer

Simple answer: learning curve to base productivity.

Framework based systems like RoR tend to put the "magic" in the language/syntax. It is very easy to ramp up on your basic RoR syntax and get an app up and going.

Java was a language first, and tools and frameworks showed up later. So you have to learn Java first, and then you have to learn Spring, or Grails, or your super IDE, or whatever. Favorite example of Ruby, it doesn't require setters and getters. Fact is, Java IDEs got rid of the manual coding too...but it is still in your source. The benefit of this approach, is that below the framework, there is a language that consistent that all Java developers can work with.

This benefit is dubious to small startups where time is of the essence. Usually, they are doing very little that they couldn't do with an out of the box framework. So they can grab their RAD system of choice and have an app live the next day.

But if you look at Facebook and Twitter, as they expanded, they found things that couldn't be handled by out of box frameworks and so they had to use lower level technologies.

This holy war that framework developers have that they can do anything faster is bogus, they can do a lot of what they need simpler and with less of a learning curve. And for a lot of things, that is "good enough." Use what is right for the problem.

share|improve this answer

To add just a bit to what's already been said, I think a lot of it has to do with how fast you can go from nothing (literally) to a functional web application.

If all you have today is an idea, going from where you are now to writing your web application is almost as easy as falling down, whether you choose a hosting provider or your own infrastructure (like an EC2 image). Choosing Java, in my experience, is usually more work, and often costs more too.

Additionally, if you go with Linux and PHP/Python/Ruby, the tools and the platform are complimentary and designed to support each other. With Java, sometimes it seems the two worlds (OS and Java) sometimes don't seem to be working in harmony with each other.

share|improve this answer

In the startup I work for we chose to use both Java and JRuby to implement our API because they complement each other.

For infrastructure, process distribution and communications we leverage Java's robustness, whereas for the actual implementation of the API endpoints we chose JRuby since all the calls involve JSON and it makes a lot more sense to manipulate a loosely-typed representation (JSON) using a loosely-typed language (Ruby).

If we see one of our JRuby classes is becoming a bottleneck, we just re-implement it directly in Java (basically a line-by-line translation). This can happen quite often with classes which must do a lot of computation, and in this context JRuby behaves much like a prototyping language.

We implemented our own dynamic class loader which means we can change Java classes on the fly without restarting the server, and we've been very happy with the choice. So the "you need to compile and restart each time" argument does not hold much weight.

The key is to avoid all the Java EE stuff - it's huge and cumbersome and anti-agile.

share|improve this answer

I still have the feeling that Java is being used in a lot of web development. But it's usually on the more business-oriented-no-mainly-tech-big-company kind of developments, which typically are less open then new startups that have to get some traction and promote their own work, as well as more interested in technology. So, even if it is used in a lot corporate web sites, you'll probably never know, as they won't really care to tell publicly about their technology stack.

That said, commenting all the original questions...

Is it a weakness of the language? Compared with other languages like Python or Ruby, Java is verbose and tends to need more code to do similar stuff. But it's not just the capabilities of the language, also the community surrounding it and the kind of developers that uses those tools. So, most of the modules and tools on Python, Ruby, PHP, etc are open source and are easier to find than in Java world, just because this one is more focused on giving (and charging) services. For example, the Ruby community is really really oriented to web development, so every developer that is able to use Ruby will know about the problems and available tools for a web project. That is not necessarily true for Java developers, that could have been working on other kind of systems, like reporting systems. Of course, any good developer will catch up, but the perception is that the average Java developer is less worried about learning new technologies and new languages.

Is it an unfair stereotype of Java because it's been around so long (it's been unfairly associated with its older technologies, and doesn't receive recognition for its "modern" capabilities)? Java is not really that old, and, being fair, it has greatly improved. It was the cool, relevant platform about 10 years ago. But since then, there have been new platforms with newer problems in mind, like Ruby on Rails. The core sector of Java has been mainly the corporate world, with different problems, so the people searching for new projects outside that has been looking for different tools. Also, the main advantage of Java design, being multiplatform, is not as relevant today as it was before.

Is the negative stereotype of Java developers too strong? (Java is just no longer "cool") That has also some truth in it. Java still is the language to learn "to get a job". So, if you don't care, but just want to learn something to earn money, you'll end learning a little Java and not caring ever again to improve. Again, is a lot about perception and visibility. There are tons of great Java developers that are coding without sharing their knowledge, while there are lots of PHP developers, maybe not as good, that are writing blogs and collaborating into open source. That leads to think that the PHP developers are better than Java ones, as you have certain feedback about them.

Are applications written in other languages really faster to build, easier to maintain, and do they perform better? I'd say that they are faster to build. The principles of languages like PHP, Python or Ruby makes them quite good for generate software that can change constantly. E.g. Dynamic typing makes easier to change an interface. In Java having a well defined interface is important, which leads to more stable (and difficult to change) interfaces. This is very important in a new startup, which main problem is to get a product before you run out of money. About performance, it is very very easy to misunderstood the needs and try to use magic tricks to achieve the required performance, like "Java is faster than Ruby. Period" or "MongoDB is web scale". Reality is more difficult than than.

Is Java only used by big companies who are too slow to adapt to a new language? Definitively, having already an existing team of Java developers in the company, makes easier to keep using the same language for new projects. This is perceived as "the safe bet", specially if the core of the company is not technology. But, anyway, Java is not ONLY used on big companies, there are still a lot of startups that uses Java for cool stuff (For example, FightMyMonster or Swrve uses Java extensively), but I'd say that the general tendency in the startup scene is to use other languages. That is also a way of getting people, as most people will be more exciting to work with Ruby, Python or PHP, perceived as more "friendly" and "fun" languages than to work with Java.

share|improve this answer

Many might associate Java and web application development with the horrors of J2EE which, bundled with monstrous J2EE application servers from big blue and red corporations, equaled weeks of work before the basic "Hello World" was online.

True, recent JEE specifications and implementations are lighter weight, but I'd still think thrice before suggesting anything like this for a short cycle rapid development project.

This is still the standards-based way of doing web application development in Java. The alternatives, many of which are mentioned in other answers, convey a more mixed and confusing picture with too many choices to make.

Other languages portray a single turnkey solution instead of this multitude. This makes this choice seem more fit-for-purpose when you have more important fish to fry.

share|improve this answer

I think it is used alot more than you'd think -- the use is just below the waterline. There are many, many ruby on rails wrappers around thick, fancy java services. Especially when you start dealing with anything approaching big data . . .

share|improve this answer

Who says it isn't?

Spring MVC + Spring Data JPA or Mongo + Thymeleaf for templating + coffee-maven-plugin for Coffee to JS transpiling and you're good to go.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.