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.

115  
I think you're incorrect: it is still used, it's just lost cool factor. –  user4051 Aug 18 '11 at 14:43
37  
@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
26  
@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
11  
@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 120 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
67  
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

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

Java was cool, Java is cool and Java will be cool in future. I'm developing a web App. Using Java.

The main problem with Java is it needs a medium size team 7-10 people to see the results of implementation. Developers of the back end must have the knowledge of application architecture from ORM to Application framework to presentation layer. Too many options for developers on the table, and this raises the questions, is it a good idea to use a ORM or not? Which ORM framework to use? Which application framework to use? How to implement the front end? All this makes the developers struggle and makes the combinations endless from the end user to pick this technology with that framework that developers are not familiar with. The same is with IDE plugins; too many options, a lot of time is spent on installing, configurating, and testing if this version of a plugin works with this version of the IDE and so on. The last thing is hosting; many developed Java Apps don't go out to public because there is no proper web hosting for Java web apps, getting one VPS for $80/month is not an option for too many developers, and most applications needs more than one VPS.

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

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'm using a lot of Java, for creating web applications. So, when it comes to the *language itsel*f, I find only one (but big) issue - lack of multiline support. This makes printing/templating in pure Java code very unreadable.

But the real problem is the lack of good web frameworks. I've worked with a lot of solutions, and none of them I could name good or even satisfying.

Most of them are in fact XML programming. In JSF you produce tons of XML, and if you want to change some general feature, like rearange labels to the top of the text fields, you'll end up in doing the same change in multiple places. Yes, you have includes, but compare them with the includes from PHP...

Additionally, new JSF includes "extra" features which were known to the JavaScript frameworks years before...

ZK is a bit better because it allows creating the web elements in the Java code, which makes the modifications easier (if you use OOP properly - inheritation etc.). However, this Java code is executed on the server side, which is a great performance issue - every click will cause a package to be sent to the server.

Well, GWT is the best web framework I've worked with. It allows object programming in the web design. Every element on the screen is represented by the Java object, which gives you full flexibility but... The compilation time is very long, and the generated Javascript is far from optimal, simply because GWT isn't utilizing fully the JavaScript possibilities (no support for the reflection, at least in the version I was using, and fatal implementation of HashMap).

You can use templates, such as Velocity, but as above, they are a poor-man's version of the templating possibilities given by such languages as PHP.

So, it's not a hate towards Java, but the lack of support for writing web apps that one will get when using PHP, Python etc...

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

If by "modern" you mean popular (as-in getting most press coverage) then the reason Java is not used is very simple -- because all the "cool kids" are using Ruby (or Python, or Clojure, or Scala, or whatever is "cool" these days).

There is a deeper meaning to this, these same people who use Ruby or Python to write their "modern" web applications are usually really great innovators. People who love solving annoying problems in simple and effective ways while saving time and brain power doing it. Some might say these are qualities of good programmers.

These people usually also create the most press around their projects, which large companies rarely do. Be it by doing lots of open-source, or writing blogs, or whatever.

So the gravitational pull of these people into the world of dynamic languages, where they are offered simpler/smaller/faster/leaner ways to solve problems is easy to understand. Sadly it means that the same people who were great Java developers, mature and abandon the Java bandwagon because it is annoying and hard (for them) to use and solve these same problems.

If creating a simple web application with MVC framework X, requires to write/edit just 100 lines of code in Rails/Django, and contrary to that it requires 10,000 lines of code in Java to do the same thing - it is very apparent why that might seem annoying.

Regarding your statement "I haven't seen anything critical "missing" from Java, preventing me from building the same application." The question is -- if you had the same amount of experience in Rails/Django/Whatever... how would these two applications Java and non-Java compare to each other, measuring time and effort and any other metrics you can come up with.

share|improve this answer

Short answer, Java is a great platform / ecosystem, just as long as you have a suitable language to develop for it in (ahem... Clojure). :)

share|improve this answer

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

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

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
  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

The problem with Java is that this language is learnt in school, so it's the language the most known by new programmers. So if you want to differentiate yourself from the mass, you have to learn a new language, Java is the language of the everybody.

The second reason is that at school or in big companies when you want to build a web application, teachers or people already in place give you tons of java frameworks to help you to build this application faster. But in fact, in this way you build your web application without really understand web (HTTP, HTML, CSS, Javascript, etc...). This trend is less visible with other languages like RoR or Python, developpers using these languages have a better understanding of the web.

So the statups who want to build modern web applications prefer to use RoR, PHP or Python to attract good web developpers, those who understand the web and not only a programming language.

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

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

Compiled langauges like Java enforce too much discipline for start-ups to follow. PHP on the other hand is moldable to the extent of being incomprehensible. Discipline and flexibility are generally opposed to each other.

share|improve this answer
1  
Startups != "undisciplined" –  canadiancreed Jun 10 '12 at 13:57

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

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

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

Java is tedious and verbose, but is still very useful when you need a cross-platform, GUI app that runs on hardware that is ill-defined.

For example, Amadeus (the largest airline/reservations system in the world) uses Java for its front end very successfully. The benefit is its simple deployability across multiple platforms (usually PC's, but of a horrendous array of specs ranging from 80386's in Peru to Core i7's in Europe). Sure it's a bit ugly, but does the trick, currently running on 10s of thousands of machines.

share|improve this answer
8  
But... we're not talking about cross-platform GUI apps: this question is about web application development. And your arguments are mismatched: "Java is tedious and verbose" is a criticism of the Java language, while all the cross-platform benefits are features of the Java platform. It is possible to write apps for the Java platform in languages other than Java: see Jython, JRuby, Groovy, Scala, Clojure, etc. –  Daniel Pryden Aug 22 '11 at 18:20

In my company we use php and not java because the final server is more expensive. For a great project it's not important, or less, but for the other projects it's a reason. the final customer want to pay as little as possible maintenance and a php server is easy to find everywhere but java hosting no.

share|improve this answer

An interesting answer is given by Dries Buytaert, who founded drupal. Although his PhD was about java, he chose php for drupal, and he didn't regret doing so. You can read it (and some of his comments) here: http://buytaert.net/why-php-and-not-java

It would have been very difficult to get critical mass if Drupal was written in Java.

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

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

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

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

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

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

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

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