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.

It's almost always true that older platforms have more third party tools, libraries, projects, and support. When compared to .NET, Java has all these privileges. But time has passed since .NET first came out and now, it is a mature platform. Are there still some areas where .NET is lagging behind Java?

share|improve this question
38  
I'd advance that Java is significantly lagging behind .NET. The older platform has more legacy code they have to support. .NET has stronger generics and lambdas, which are quite massive advantages, plus other serious language advantages. –  DeadMG Oct 18 '11 at 13:17
6  
Well, not to mention that the .NET jazzy groovy stuff doesn't work as well as java does on linux. Yes, the bearded people have already won on the server side. –  deadalnix Oct 18 '11 at 14:07
6  
Damn, I so should have posted that comment as an answer. –  DeadMG Oct 18 '11 at 16:09
22  
-1 for everyone who answered about C# vs java instead of .net vs jvm (which is "The java platform") –  Bill K Oct 18 '11 at 18:56
6  
Why doesn't "that Mono crap" count? –  Aaronaught Oct 19 '11 at 0:55
show 7 more comments

closed as not constructive by FrustratedWithFormsDesigner, Walter, Jarrod Roberson, Aaronaught, Mark Trapp Oct 20 '11 at 21:16

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.

10 Answers

Java has several disadvantages to .NET.

Being the older platform, Java only has some of the lessons that C++ taught us about how not to do object orientated programming languages. It also has a wider variety (think duplication) of add on libraries in common use. (.NET tends to use the micorosft version)

However, the key is that a programming language is not a religion, but a tool to complete a task. Java has the edge in some respects. Its performance can be noticable better than C#, it has prominance in the newer NoSQL datastore technologies, and noticably, as a website becomes heavily used, think 100,000's concurrent users, the technology used to deliver the website seems to move from .NET to java.

share|improve this answer
4  
Really ? Could you provide some real-world facts on Java applications being more scalable than .NET applications and when/why it is "noticably better" ? In fact, please also provide facts about why it has prominence in NoSQL datastore technologies ? –  Jalayn Oct 18 '11 at 13:33
1  
The performance of the JVM versus the .NET runtime is debatable. I haven't seen a valid study make this assertion unless you can prove me wrong right now. Other than that I agree with everything else in your post. –  maple_shaft Oct 18 '11 at 13:35
2  
Both .NET and Java's OO features are worse than C++'s. –  DeadMG Oct 18 '11 at 13:55
2  
Jalayn, have a look at the Wikipedia list of NoSql databases, and look at the technology used to implement each product. Java and Erlang both seem to be used in several implementations, with .NET a noticably rarer choice by the implementors. –  Ptolemy Oct 18 '11 at 13:57
1  
These guys made the JVM do things I didn't think it could. infoq.com/presentations/LMAX - I do not know what JVM they did it on. –  user1249 Oct 18 '11 at 14:00
show 6 more comments

The only area I can think of is cross-platform support. Java was developed with this in mind from the start. You can argue that Mono gives you cross-platform support on .NET, but having investigated it, you can't really get the portability that Java gives you (if you start developing in .NET 4 on Windows and want to port elsewhere).

Edit: As @maple_shaft says, Java enums are also more advanced than .NET's.

For most everything else, it seems .NET is more advanced.

share|improve this answer
    
See programmers.stackexchange.com/questions/20275/… –  user1249 Oct 18 '11 at 13:56
    
@ThorbjørnRavnAndersen - miguel's answer is a bit like marketing spin, but it does have lots of useful information. –  Scott Whitlock Oct 18 '11 at 14:23
    
He should know what he is talking about. –  user1249 Oct 18 '11 at 15:28
    
@ThorbjørnRavnAndersen - agreed! :) –  Scott Whitlock Oct 18 '11 at 15:36
1  
+1 For me this is a HUGE advantage. I once worked on a Java application for Windows. My colleagues used Eclipse under Windows, I used Eclipse under Linux. We all checked in to the same repository and never changed a line of code. –  Giorgio Oct 19 '11 at 12:03
add comment

I would say they are lagging behind in adoption by the open source community. There are fewer library and framework choices in the .NET platform and usually the best quality ones are proprietary IMHO. Even this has been changing lately however as there are more open source projects starting on the .NET platform than ever before.

I would also like to see .NET adopt some of the Java language features for enum's. I have always liked Java's implementation of enum's better.

With that being said .NET (C#) truly is the superior language.

share|improve this answer
    
Can you give some more detail on what aspects of the enums are more advanced? I didnt know that they were –  Tom Squires Oct 18 '11 at 13:56
3  
@TomSquires Without going into too much detail the answer to this SO question sums it up better than I could. stackoverflow.com/questions/469287/… –  maple_shaft Oct 18 '11 at 13:59
3  
I'd argue that having fewer open source projects focuses the community on improving those few projects. In Java you have a lot of options but talent is being spread pretty thin. All it takes is a few bright developers to abandon a project you're interested in for the next new hotness and you're a bit out of luck. –  R0MANARMY Oct 18 '11 at 14:06
2  
And VB.Net wipes the floor with C#. Ok not really, but I find it odd that VB.Net as some truly superior features such as way better background compilation (more of an IDE thing), and also has XML Literals. I think there are a few places where VB really is better then C#, but it's really 6 of one, half dozen of the other. –  Kibbee Oct 18 '11 at 16:05
1  
@Kibbee, I would differ with you on lambdas, where the syntax in VB.NET is comparatively awkward and verbose –  JoelFan Oct 18 '11 at 17:03
show 4 more comments

In most areas, .NET is ahead of Java. But there are a few nice features in Java, I'd like to see in .NET:

  1. True cross platform support. Java runs on my cellphone, my Irix workstation, my Linux box, Windows 7 machine, and Macs. Oh, and it also runs in the browser.
  2. A unified runtime. .NET has 4 runtimes currently: .NET (standard), WinRT, Silverlight, and Windows Phone 7. Some will say "it's all .NET", but as a programmer who writes Silverlight and .NET code for a living, they are not. Just try writing a binary serializer in Silverlight. BinaryWriter has .WriteDecimal in .NET but not in Silverlight. And with WinRT things are just getting worse. At least in Java we have a unifined API.
  3. I would love to have Java style anonymous classes in .NET. .NET has anonymous types, but they don't support inheritance or methods.
  4. Finally, I'd like to see a little better JIT performance. From what I understand, .NET doesn't perform profiling as it runs. This is something HotSpot does, and it gives a small boost. But I guess this point could be considered subjective.

I was hard pressed to come up with the above areas where Java beats .NET. Instead, I would say that .NET beats java in the following ways:

  1. Better functional programming support (lambda statements)
  2. Faster start-up times. .NET functions are Jitted the first time they are encountered. Java (at least Sun Java) profiles the function for roughly 1000 interations before jitting it, this often means longer start-up times
  3. Checked Exceptions. .NET doesn't have them....enough said.
  4. Classes != Namespace. There's no reason why foo.lang.bar.Baz should be in foo/lang/bar/Baz.java . C# gets by just fine without it, and I've never missed this "feature" in C#.
  5. Incomplete stack machine. The instruction set in C# has a reduced set of functions than what are allowed in Java. This allows for better optimization, since the compiler can make assumptions about how data will be handled. E.g. in C# values can only be popped or pushed onto the stack. In Java they can can be pushed, popped, duplicated, swapped, etc.
  6. Linq - That's almost enough reason to switch to C# right there.
  7. Linq.Expressions - Meta-programming has never been easier

These are just a few reasons why I program in .NET instead of Java

share|improve this answer
2  
I see you've never tried programming for J2ME. CDC/PP is parallel to Silverlight, I think, in that it's a cut down version of J2SE. CDLC/MIDP is really restricted. –  Peter Taylor Oct 18 '11 at 14:25
1  
Irix workstation? Sounds like a pretty old and slow JVM to me. –  user1249 Oct 18 '11 at 15:28
    
Granted, Irix workstations are pretty old...but my point was that the JVM runs on almost any hardware on the planet, IBM, Sun, Azul, x86, Itanium, etc. –  Timothy Baldridge Oct 18 '11 at 16:19
1  
He didn't ask about .net vs java, he asked .net vs the java platform. The java platform includes scala and hundreds of other languages so comparing language features seems pointless. compare platform features. –  Bill K Oct 18 '11 at 18:55
1  
@Bill -- you have a point, but half of my comments still apply. –  Timothy Baldridge Oct 18 '11 at 19:41
show 2 more comments

You need to be careful about comparing languages vs platforms.

Languages

C# 4.0 vs Java 7

C# 4 has some advantages over Java 7. Most notably in reified generics, lambdas/closures and the ability to use LINQ. This is enough to have made some programmers make the shift.

  • Lambdas/closures won't come into Java until version 8 (2013)
  • Reified Generics may or may not come in Java 9 (there are some reasons why this needs some extra engineering effort and thought).

C# 4.0 vs Other JVM languages

There are now several languages on the JVM which offer some of the C# features (lambdas for example) and interoperate with Java such as Groovy, Scala and Clojure. There are typically open source Java libraries which try to fill in other gaps.

.NET vs JVM languages

In terms of choice the JVM wins hands down. I can't speak to the language interop story on .NET but I suspect its's very good. I know that with Java 7's JVM, language interop has a fairly strong story.

Platforms

This topic is so vast it's hard to even get started.

Broad statements

  • The .NET platform is more tightly integrated and easier for developers to work with
  • The .NET platform is pretty much stuck on Windows
  • The .NET platform doesn't have the same level of performance as the JVM when you really push it, e.g. The London Stock Exchange. But hey they haven't been around so long, so give em a chance!

  • The Java platform has much more variety and choice, it's open source library story is vast.

  • The JVM is IMO the most kick butt general purpose VM on the planet today (I did say IMO ;p).
  • The Java platform is not stuck on Windows, it has a pretty decent story on most O/S's, platforms

A couple of related answers

share|improve this answer
18  
JVM is a poorer VM than CLI, with the only advantage of a proper, usable class GC. Targeting JVM is a pain, targeting CLI is easy. JVM shortcomings are: 1) stupid, awful limit on a method size. It is plainly disgusting. 2) lack of explicit tail call annotations. 3) lack of explicit value types. 4) lack of unsafe pointer arithmetics. 5) unnecessarily complicated set of stack instructions. So, from a compilers developer point of view, JVM does not even deserve a comparison with .NET. –  SK-logic Oct 18 '11 at 16:25
2  
P.S., and JVM can't be called a "general purpose" VM. It is far from being usable for implementing efficiently of anything else but Java. –  SK-logic Oct 18 '11 at 16:27
4  
sounds like what we really want is C# that compiles to Java bytecode. –  Doug T. Oct 18 '11 at 16:36
12  
mono does a very nice job bringing the .Net platform to places other windows... including a few places where you'll have to look pretty hard to find Java, like xbox, Windows Phone, and iOS (even if 2 of the 3 are direct from Microsoft). I also have my doubts about the VM performance gap. –  Joel Coehoorn Oct 18 '11 at 19:24
6  
+1 for highlighting the difference between language and platform, -2 for making a lot of unsubstantiated and dubious claims about performance and platform independence. –  Aaronaught Oct 19 '11 at 0:57
show 12 more comments

IMO .NET lags behind in adoption of software craftsmanship and proper software engineering principles. Things like design patterns, the SOLID principles, separation of concerns, and leveraging open-source tools like ORMs are all widely accepted as the "standard" way of doing things in Java, while in .NET it's very rare to find a .NET shop that knows or uses those things - in my experience at least most .NET shops are hacks that rely on code-behind and tapping directly into database classes/proliferation of stored procedures to do things, and the notion of abstraction is lost. The average .NET shop has never heard of an ORM, or Continuous Integration, or anything of that nature and blissfully copies and pastes logic across .aspx.vb or .aspx.cs code-behind files.

This has been my personal experience with .NET over the course of six years as a developer. I have found most .NET shops in my locale to know zero about things like design patterns, SOLID, ORMs or the like and focus 100% on quick and dirty hacks and then move on to the next task instead of developing with an eye towards maintainability and craftsmanship.

share|improve this answer
7  
I have had the opposite experience. You just work with a bunch of losers and nobodies. Leave that one horse town and go where there are real jobs. –  maple_shaft Oct 18 '11 at 16:08
3  
Before anyone else down-votes Wayne, I think he should have a chance to elaborate his answer or link to case-examples. –  Lo Sauer Oct 18 '11 at 17:11
5  
Your answer is too localized. –  DeadMG Oct 18 '11 at 17:49
5  
You are critiquing the .NET developer community. The question is clearly about the platform itself, not those who are using it. –  System Down Oct 18 '11 at 19:20
2  
I bet there would be some guy out here who got the same thing to say for Java (people using java :) ) –  V4Vendetta Oct 19 '11 at 4:55
show 5 more comments

I'd advance that Java is significantly lagging behind .NET. The older platform has more legacy code they have to support. .NET has stronger generics and lambdas, which are quite massive advantages, plus other serious language advantages like operator overloading.

Case in point: Generics. .NET got much better generics, because Java was too scared of making existing bytecode be incompatible.

share|improve this answer
    
.net has generics? Can you explain how generics are implemented in VB? –  Bill K Oct 18 '11 at 22:40
3  
@BillK: Generics are fully baked into the .Net type system. Java generics exist up until compile time, when the extra type information is thrown away. In vb.net, you declare a List(Of string), if that's what you were asking instead. –  Andy Oct 19 '11 at 0:23
add comment

One difference are definitely the *user numbers, with even more dramatic differences amongst an academic user-base:

The following numbers are the times of how often Google’s API examples were favorited by users, which are given below for several programming languages.

Google may indeed provide a good example for a technical-web project with lesser bias than the statistics of other projects, owing to Google's 'widespread' nature.

  • 500 Java
  • 230 Python
  • 200 PHP
  • 110 Objective C
  • 100 .NET
  • 30 Ruby

All API project examples were started around Q4/2010.

share|improve this answer
add comment

Many answers are comparing Java to .net which makes no sense to me at all--I'd think people would know better.... Perhaps you mean to compare Java to VB? That would at least work.

Also he didn't ask about Java vs C# at all, so he must have meant the JVM vs .net

The JVM has many many more languages available to it, it's multi-platform and you can get the source code for starters.

It's also more performant (last time I checked).

.net has better tool integration I believe and better OS integration, but lags in nearly every other area as far as I know. I'd really enjoy hearing other cases where .net was more advanced than the JVM (which is what the OP was asking, I believe).

If you widened the scope from .net to .net-like platforms and include MONO, you may get more answers.

--edit--

I was just looking up the performance of .net vs jvm. The responses vary widely and I can't tell which are biased (Most seemed quite slanted and tested the slow java 5 vs newer C# releases).

Although that was kind of a wash hile I was looking I found this post which seems to have some great answers to the original question:

http://www.adam-bien.com/roller/abien/entry/java_ee_or_net_an

as well as advantages of .net. worth looking at.

share|improve this answer
    
You can also get the source code for .Net, and you should check again on the performance. –  Joel Coehoorn Oct 18 '11 at 19:29
    
@Bill K., "many many more languages" available does not make any difference, since all of them are either identical to Java or poorly implemented, because JVM is not suitable for implementing anything else but Java (yes, I count Clojure as poorly implemented). And yes, if you widen your scope to include Mono, you'll get more advantages, like: tiny, really embeddable VM (still with a powerful JIT compiler), support for SIMD acceleration, native code packaging, ad hoc AOT, pure native code generation (e.g., in MonoTouch). –  SK-logic Oct 19 '11 at 6:54
    
@SK-logic: do you live in this world? Do you know Scala? Scala is very different from Java, has a very good implementation and is used for serious applications. It supports a combination of functional and object oriented programming style, uses the JVM and can use all the Java libraries. –  Giorgio Oct 19 '11 at 9:50
    
@Giorgio, Scala implementation is far from efficient. And you can't even use it for a serious FP-centric development due to the lack of tail calls support, for example. And, I am not at all impressed by the language itself, but that's a different story. –  SK-logic Oct 19 '11 at 9:53
1  
@Giorgio, yes, either a specially designed VM, or a VM generic enough to accomodate a wide variety of semantics. JVM, unfortunately, was originally designed for Java only, while .NET (which is still far from an ideal, of course) was designed for hosting many different languages from the very beginning. And, by the way, I can use all those libraries and languages too, and I'm actually using them in production code, alongside with some native libraries and tons of .NET libraries, thanks to the IKVM. –  SK-logic Oct 19 '11 at 11:21
show 3 more comments

Java as a language is IMO at least one generation behind C#. On the other hand number of ported libraries from Java to .NET exceed number of contrary ports in order of magnitude.

share|improve this answer
add comment

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