110

How much less libraries are there for Mono than for Java?

I lack the overview over both alternatives but I have pretty much freedom of choice for my next project. I'm looking for hard technical facts in the areas of

  • performance (for example, I'm told Java is good for threading, and I hear the runtime code optimization has become very good recently for .NET)
  • real world portability (it's both meant to be portable, what's Catch-22 for each?)
  • tool availability (CI, build automation, debugging, IDE)

I am especially looking for what you actually experienced in your own work rather than the things I could google. My application would be a back-end service processing large amounts of data from time series.

My main target platform would be Linux.

Edit: To phrase my question more adequately, I am interested in the whole package (3rd party libraries etc.), not just the language. For libraries, that probably boils down to the question "how much less libraries are there for Mono than for Java"?


FYI, I have since chosen Java for this project, because it seemed just more battle-worn on the portability side and it's been around for a while on older systems, too. I'm a tiny little bit sad about it, because I'm very curious about C# and I'd love to have done some large project in it, but maybe next time. Thanks for all the advice.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Hanno Fietz
  • 30,799
  • 47
  • 148
  • 234

15 Answers15

113

Mono does a better job at targeting the platforms I want to support. Other than that, it is all subjective.

I share C# code across the following platforms:

  • iOS (iPhone/iPad)
  • Android
  • The Web (HTML5)
  • Mac (OS X)
  • Linux
  • Windows

I could share it even more places:

  • Windows Phone 7
  • Wii
  • XBox
  • PS3
  • etc.

The biggie is iOS since MonoTouch works fantastically. I do not know of any good way to target iOS with Java. You cannot target Windows Phone 7 with Java, so I would say that the days of Java being better for mobile are behind us.

The biggest factor for me though is personal productivity (and happiness). C# as a language is years ahead of Java IMHO and the .NET framework is a joy to use. Most of what is being added in Java 7 and Java 8 has been in C# for years. JVM languages like Scala and Clojure (both available on the CLR) are pretty nice though.

I see Mono as a platform in it's own right (a great one) and treat .NET as the Microsoft implementation of Mono on Windows. This means that I develop and test on Mono first. This works wonderfully.

If both Java and .NET (Mono let's say) were Open Source projects without any corporate backing, I would choose Mono over Java every time. I believe it is just a better platform.

Both .NET/Mono and the JVM are great choices, although I would personally use some other language than Java on the JVM.

My take on some of the other comments:

Issue: Performance.

**Answer: Both the JVM and the CLR perform better than detractors say they do. I would say that the JVM performs better. Mono is generally slower than .NET (though not always).

I personally would take ASP.NET MVC over J2EE any day both as a developer and an end-user. Support for Google Native Client is pretty cool too. Also, I know that poor GUI performance for desktop Java apps is supposed to be a thing of the past but I keep finding slow ones. Then again, I could say the same for WPF. GTK# is plenty fast though so there is no reason they have to be slow.

Issue: Java has a larger ecosystem of libraries available.

Answer: Probably true, but it is a non-issue in practice.

Practically every Java library (including the JDK) runs just dandy on .NET/Mono thanks to IKVM.NET. This piece of technology is a true marvel. The integration is amazing; you can use a Java library just like it was native. I have only had to use Java libraries in one .NET app though. The .NET/Mono ecosystem generally offers more than I need.

Issue: Java has better (broader) tools support

Answer: Not on Windows. Otherwise I agree. MonoDevelop is nice though.

I want to give a shout-out to MonoDevelop; it is a jewel. MonoDevelop integrates most of the tools I want use including code completion (intellisense), Git/Subversion integration, support for unit tests, SQL integration, debugging, easy refactoring, and assembly browsing with on-the-fly decompilation. It is wonderful to use the same environment for everything from server-side web to mobile apps.

Issue: Compatibility across platforms.

Answer: Mono is a single code-base across all platforms, including Windows.

Develop for Mono first and deploy to .NET on Windows if you like. If you compare .NET from MS to Java though then Java has the edge in terms of consistency across platforms. See next answer...

Issue: Mono lags .NET.

Answer: No it does not. IMHO, this is an often stated but incorrect statement.

The Mono distribution from Xamarin ships with C#, VB.NET, F#, IronPython, IronRuby, and I think maybe Boo out of the box. The Mono C# compiler is completely up to date with MS. The Mono VB.NET compiler does lag the MS version. The other compilers are the same on both platforms (as are other .NET languages like Nemerle, Boo, and Phalanger (PHP) ).

Mono ships with a lot of the actual Microsoft written code including the Dynamic Language Runtime (DLR), Managed Extensibility Framework (MEF), F#, and ASP.NET MVC. Because Razor is not Open Source, Mono currently ships with MVC2 but MVC3 works on Mono just fine.

The core Mono platform has kept pace with .NET or many years and the compatibility is impressive. You can use the full C# 4.0 language and even some C# 5.0 features today. In fact, Mono often leads .NET in many ways.

Mono implements parts of the CLR spec that even Microsoft does not support (like 64 bit arrays). One of the most exciting new pieces of technology in the .NET world is Roslyn. Mono has offered the C# compiler as a service for many years. Some of what Roslyn offers is available via NRefactory as well. An example of were Mono is still ahead would be the SIMD instructions to accelerate gaming performance.

Microsoft does offer a number of products on top of .NET that are not available in Mono which is were the misconception about Mono lagging comes from. Windows Presentation Foundation (WPF), Entity Framework (EF), WCF (Windows Communication Foundation) are examples of products which do not work, or are poorly supported, on Mono. The obvious solution is to use cross-platform alternatives like GTK#, NHibernate, and ServiceStack instead.

Issue: Microsoft is evil.

Answer: True. So what.

Many people offer the following reasons to avoid using Mono:

  1. You should not use Mono because Microsoft tech should be avoided

  2. Mono sucks because it does not let you use every technology that Microsoft offers

To me, it is clear that these statements are incompatible. I reject the first statement but will skip that argument here. The second statement is true of all .NET alternatives.

The JVM is a great platform and the explosion of JVM languages is awesome. Use what makes you happy. For now, that is often .NET/Mono for me.

Justin
  • 8,853
  • 4
  • 42
  • 42
  • 3
    Thanks for such an extensive answer that late in the game. I have not used Mono/.Net/C# ever, but your post seems to reflect some of the more recent developments in that universe. For instance, I don't recall MonoTouch being that significant 3.5 years ago. – Hanno Fietz Feb 02 '12 at 14:13
  • 3
    I'm confused by your "Mono does not lag .NET" answer. You claim that, then state half a dozen ways in which it does, in fact, lag .NET (Entity Framework, etc). It's safe to say it doesn't lag Microsoft's C# compiler, but the .NET ecosystem is fragmentary at best on Mono. That seems to be OK for your purposes, but not for everyone, and there is a legitimate concern there. – samkass Apr 25 '12 at 16:38
  • 1
    @samkass: I think the point here is the difference between 'lags' and 'does not implement this library'. In the Java world, you can find this analogous to Android not implementing the Swing library. Please also note that the cross-platform (and open source, btw) equivalents were given. I'm using Mono every day and 'fragmentary at best' definitely wasn't my experience. – konrad.kruczynski Apr 28 '12 at 09:36
  • 9
    The lack of complete and robust WCF and EF support, and no WPF is a killer for Mono for just about everything I have worked on since .NET 3.0. Yes there are alternatives but a huge part of the power of .NET is these additional frameworks. Without these I don't think you can call Mono compatable with .NET at all. It is a partial implementation at best. I have also used NHibernate and frankly EF is a way better technology. Never used ServiceStack. IMO Mono is much to much of a risk. – MrLane Jun 12 '12 at 02:57
  • I have to say I agree with @samkass and MrLane about Mono's "lagginess". The claim I made in my answer about this isn't making the (very fine) distinction between the core language runtime - which Mono keeps up with - and the other frameworks and libraries Microsoft produces that most .NET developers would consider essential to the overall .NET platform. I think this distinction is very academic and not useful to people trying to decide whether or not Mono will be portable for their purposes. – Ben Collins Aug 31 '12 at 19:04
  • Wow. Thanks for wonderful information. – rpattabi Mar 26 '13 at 15:10
  • MSFT supports .Net on Windows and their mobile OSes. Mono is officially "unsupported" on many Linux distos. Java is a spec with supported implementations on many platforms. – Michael M Jun 19 '13 at 23:33
  • 1
    everybody who misses WCF should take a look at servicestack. seriously, not implementing WCF was a good thing! – unreal Oct 29 '13 at 16:01
  • 1
    It might also be added that Oracle can also be considered evil, newerhteless people still use Java, and not use this argument against it – SztupY Feb 07 '14 at 23:33
  • Note that MS has recently fully [open-sourced Roslyn](http://visualstudiomagazine.com/articles/2014/04/03/microsoft-open-sources-roslyn-compiler.aspx) – Basic Jun 04 '14 at 17:44
  • @Michael.M [C# is a spec](https://msdn.microsoft.com/en-us/library/ms228593.aspx?f=255&MSPPError=-2147217396) with implementations on multiple platforms. What's your point? – Basic Sep 18 '15 at 23:41
  • @Basic, just because something is implemented, does not mean it's officially supported. If it's not officially supported I wouldn't deploy it in a client's environment. But hey ... I guess some people are oblivious to the difference. My point is that OP should not be, and should take that into consideration for *his* particular case. – Michael M Sep 21 '15 at 21:03
  • @Michael.M You do have a point and I was playing devil's advocate. MS is clearly behind the Java world on x-platform, but even so, it has nothing to do with being an open spec, just a longer pedigree. In any case, yes it's something the OP should consider, I agree – Basic Sep 21 '15 at 21:20
96

Well....Java is actually more portable. Mono isn't implemented everywhere, and it lags behind the Microsoft implementation significantly. The Java SDK seems to stay in better sync across platforms (and it works on more platforms).

I'd also say Java has more tool availability across all those platforms, although there are plenty of tools available for .NET on Windows platforms.

Update for 2014

I still hold this opinion in 2014. However, I'll qualify this by saying I'm just now starting to pay some attention to Mono after a long while of not really caring, so there may be improvements in the Mono runtime (or ecosystem) that I haven't been made aware of. AFAIK, there is still no support for WPF, WCF, WF, of WIF. Mono can run on iOS, but to my knowledge, the Java runtime still runs on far more platforms than Mono. Also, Mono is starting to see some much improved tooling (Xamarin), and Microsoft seems to have a much more cross-platform kind of attitude and willingness to work with partners to make them complimentary, rather than competitive (for example, Mono will be a pretty important part of the upcoming OWIN/Helios ASP.NET landscape). I suspect that in the coming years the differences in portability will lessen rapidly, especially after .NET being open-sourced.

Update for 2018

My view on this is starting to go the other way. I think .NET, broadly, particularly with .NET Core, has started to achieve "portability parity" with Java. There are efforts underway to bring WPF to .NET Core for some platforms, and .NET Core itself runs on a great many platforms now. Mono (owned by Xamarin, which is now owned by Microsoft) is a more mature and polished product than ever, and writing applications that work on multiple platforms is no longer the domain of deep gnosis of .NET hackery, but is a relatively straightforward endeavor. There are, of course, libraries and services and applications that are Windows-only or can only target specific platforms - but the same can be said of Java (broadly).

If I were in the OP's shoes at this point, I can think of no reason inherent in the languages or tech stacks themselves that would prevent me from choosing .NET for any application going forward from this point.

Ben Collins
  • 20,538
  • 18
  • 127
  • 187
  • 2
    I'am really glad to read this and joyfull about the votes in a Microsoft world. .NET is really good but Java have a legitimity as I always tried to explain as a .NET developper and an old Java one ;) – JoeBilly Apr 01 '10 at 12:29
  • +1 for this. I've found Java portability (for non-trivial applications, i.e. web servers, complex GUIs, analytical engines) to be better than any other alternative. It's not quite perfect, but it is the best you can get right now. – mikera Dec 20 '12 at 09:00
  • 1
    @Ben , do you still hold this opinion in 2013? If you do, would you mind mentioning so, and if you don't updating this answer? A lot of times when reading 4 year old answers it's hard to tell. – Benjamin Gruenbaum May 28 '13 at 15:21
  • 1
    @BenjaminGruenbaum yes, although I'd qualify my opinion at this point by saying that I haven't paid much attention to Mono in a long while, so there may be improvements in the Mono runtime (or ecosystem) that I haven't been made aware of. AFAIK, there is still no support for WPF, WCF, or WF. Mono can run on iOS, but to my knowledge, the Java runtime still runs on far more platforms than Mono. So...yes. Qualified, but yes. – Ben Collins May 28 '13 at 16:04
  • @HighCore the argument isn't *against* Mono, per se. It's just a statement of fact: if you write code dependent on WPF, then you can't use Mono; ergo it is unportable in that way. Java's UI frameworks may suck, but as far as I know they will work anywhere that Java works (and the hardware supports that kind of UI). That doesn't make Java *better*, it makes it more portable in this specific way. – Ben Collins Oct 08 '14 at 22:37
  • @HighCore, I never said there were no workarounds, and this feels like it's descending into an argument over subjective preferences which are really off-topic. Xamarin.Forms is mobile-only, and so it doesn't really add much to the portability landscape, and it doesn't really have anything to do with WPF from what I can tell. I think I still stand by my answer. – Ben Collins Oct 08 '14 at 23:10
  • @FedericoBerasategui I'm right here :) .. and I give a damn about Linux on the desktop – Shane Aug 11 '18 at 08:59
54

I actually develop in .NET, run all my tests first on Mono, and then on Windows. That way I know my applications are cross platform. I have done this very successfully on both ASP.NET and Winforms applications.

I am not really sure where some people get the impression Mono is so horrible from, but it certainly has done it's job in my cases and opinions.It is true you will have a bit of lag for the latest and greatest inventions in the .NET world, but so far, .NET 2.0 on Windows and Linux is very solid for me.

Keep in mind there are obviously many quirks to this, but most of them come from making sure you are writing portable code. While the frameworks do a great job of abstracting away what OS you are running on, little things like Linux's case sensitivity in paths and file names takes a bit of getting used to, as do things like permissions.

.NET is definitely very cross platform due to Mono based on my experiences so far.

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
  • Call me ignorant, but do you even need to test ASP.NET with mono? Everything that would be .NET is server side, thus is doesn't matter which OS it's displayed on does it? – Ethan Gunderson Sep 14 '08 at 19:54
  • 9
    Ethan, using Mono you can host ASP.net apps on Linux. – Eric Haskins Sep 14 '08 at 20:01
  • EHaskins, I think what Ethan was getting at is that why bother making it cross platform for ASP.NET when you control the server... just run it on Windows... Fogbugz type applications would be an exception (with possibility to run on client's server) – Mike Stone Sep 14 '08 at 20:09
  • 2
    Not everyone wants to run their app on Windows, for whatever reason. – Bernard Sep 15 '08 at 01:43
  • One problem with Mono lagging behind the MS implementation is when you have major API changes (.NET 3.5 with W?F, for example). By the time you get there in Mono, you're so far behind the rest of the world, you may be less competitive (not always the case, but one of the risks of being behind). – Ben Collins Sep 15 '08 at 01:56
  • @Ben Collins: I don't really believe that is a valid argument. I would always recommend to a developer to stay up to date with the newest frameworks, but I would never recommend they start using those new frameworks in production code without some latency. Frameworks have their problems after all... – GEOCHET Sep 15 '08 at 04:04
  • @mike Stone: When trying to stay competitive, you will sometimes find clients who do not have or do not wish to have MS products in their server racks. I cannot say I agree, but I can certainly respect their wishes. Therefore, being able to run my apps on Linux is a large benefit. – GEOCHET Sep 15 '08 at 04:06
  • @Rich B: this discussion is about portability, not best practices for using frameworks in production code. The fact is that there are more up-to-date implementations of java across more platforms than .NET. I've got nothing against .NET, but it just can't compare to Java in portability. – Ben Collins Nov 28 '08 at 04:54
  • 2
    @Rich B: if a client doesn't want MS products, .NET is clearly the wrong choice. – Kjetil Ødegaard Mar 09 '09 at 11:27
  • 21
    @Kjetil: Mono is not an MS product. – GEOCHET Mar 09 '09 at 11:41
  • @Kjeyil and C# also has an ECMA standard, so could argue that it also is not an MS product – AaronLS Aug 20 '12 at 02:49
26

Java actually is as cross-platform as everyone says it is. There's a JVM implementation for just about any mainstream OS out there (even Mac OS X, finally), and they all work really well. And there's tons of open source tools out there that are just as cross platform.

The only catch is that there are certain native operations you can't do in Java without writing some DLLs or SOs. It's very rare that these come up in practice. In all those cases, though, I've been able to get around it by spawning native processes and screen-scraping the results.

jodonnell
  • 49,859
  • 10
  • 62
  • 67
  • 1
    Also, in pretty much every case where Java can't do a native operation in a cross-platform manner, the same will be true for .NET – Eli Courtwright Sep 15 '08 at 00:05
  • Finally? Mac OS X has had a JVM implementation since 10.0. :) – mipadi Feb 07 '10 at 17:58
  • 3
    @Eli - Probably true. It is certainly much, much easier to integrate with native functionality in .NET/Mono than it is in Java though. So, if you are just trying to integrate well with the native platform, .NET/Mono offer a real advantage. – Justin Jan 27 '12 at 19:09
  • "spawning native processes and screen-scraping the results" *shudder* – Basic Jun 04 '14 at 17:48
  • I would quibble with 'just about any mainstream OS', as there isn't a JVM out of the box for either Android or iOS. With the new portable class libraries in .NET, meanwhile, you actually can share compiled code (though not practically UI code) across platforms including mobile. – Mathieson Aug 16 '14 at 00:49
18

I think the question is phrased incorrectly. C# vs. Java is much less interesting in terms of cross-platform usage than is (a) which platforms you need to support, and (b) considering the core libraries and available third party libraries. The language is almost the least important part of the decision-making process.

Brad Wilson
  • 67,914
  • 9
  • 74
  • 83
15

Java is a better choice for Cross-Platform development.

  • Performance. Java and .Net have similar performance level due to the virtual machine, but JVM normally has better performance because of years and years optimization.

  • Library. Although this depends on your task, Java has much more open source or third party libraries available there. For server App, J2EE, Spring, Struts, etc. For GUI, although .Net provides Win32 layer API but this causes compatibility issues. Java has Swing, SWT, AWT, etc. It works in most cases.

  • Compatibility. This is the key issues that need to be considered when develop the cross-platform program. Two issue: first, platform compatibility. Java still wins since JDK is well maintained by single and original company Sun. Mono is not maintained by MS, so you have no guarantee yet for update compatibility. 2. Backward compatibility. Sun maintains a good reputation on their backward compatibility, although sometimes this seems too rigid and slows the pace.

  • Tools. Java has good cross-platform IDEs. Netbeans, Eclipse, etc. Most of them are free. VS Studio is good but only on Windows, and not cost a bit. Both of them provides good unit tests, debugs, profiles, etc.

Hence I'd suggest that Java is a better choice. As a show case, there are some famous desktop cross-platforms apps developed by Java: Vuze, Limewire, BlogBridge, CrossFTP, not to mention those IDEs. As to .Net, I have limited knowledge on such success apps.

Gatorhall
  • 411
  • 4
  • 7
  • Working with mono on "other" Linux has gotten tricky. This reflects the major problem with mono: The future of mono is too dependent on the dictatorship of Miguel de Icaza. Case-in-point: Dwindling support for "other ...(unsupported)" [http://www.mono-project.com/Other_Downloads] Linux seems to correlate (**IMHO**) with Miguel de Icaza's disillusionment with Linux (http://tirania.org/blog/archive/2013/Mar-05.html). Java does not suffer this dictatorship problem. C# may run on more platforms, but that comes with more cost, risk, compromise and dependence on Mr. de Icaza. No thanks. – Michael M Apr 13 '13 at 19:00
  • @Michael.M so you'd rather prefer being at the whim of Oracle? – Thorbjørn Ravn Andersen Jun 19 '13 at 18:17
  • @ThorbjørnRavnAndersen: Wrong. Let me break it down as simply as I can: **.Net**-->MSFT *platform* (stable successful company; limited but neat eco-system) ; **Mono**-->De Icaza *framework* (el dictador; not hot for Linux and it shows:[http://www.cultofmac.com/218632/linux-gnome-more-gnome-creator-ditches-linux-for-mac/] - try installing mono on Centos 6.4, it's an "unsupported" nightmare) ; **Java** is a *specification* which belongs to the community and has many different vendor implementations (Oracle is just one) [http://www.coderanch.com/t/327542/java/java/Java-Forums-JAVA-Language-dumb] – Michael M Jun 19 '13 at 23:17
  • @ThorbjørnRavnAndersen: .. moreover a major Java community sponsor can even exclude Oracle and still be successful and extremely well supported - *Java is by no means at the whim of Oracle* --- please see: http://news.techworld.com/applications/3252787/apache-withdraws-from-java-community-process/ Oracle could dump all their Java involvement and it would still live on. What other vendors have a .Net platform? Who else provides a mono runtime other than Xamarin? Java is the only one of these not subject to dictatorship and has true community control, community support and community stewardship. – Michael M Jun 19 '13 at 23:28
  • 1
    @Michael.M Specification? Belonging to the community? I think you are wrong - I also believe that the _only_ reason that the OpenJDK project was not shut down after the acquisition of Sun, was the GPL. Java is in the iron fist of Oracle, simply because the TCK is not freely available and that is what is needed to make a JVM which behaves like the Oracle JVM. I do not have a problem with Mono or De Icaza, but I do not think that the Java situation is much better. The only alternative JVM project with momentum died when IBM stopped supporting it. – Thorbjørn Ravn Andersen Jun 20 '13 at 00:44
  • And whats wrong with the **plethora** of other JVMs? (http://en.wikipedia.org/wiki/List_of_Java_virtual_machines) Yes, the JCP and OpenSource JVM projects are closer to a community process than **anything** that either .Net or Mono have. The common reason why open source JVM projects die is because there are just so many darn free implementations already - I really honestly; truly; sincerely; wish from the bottom of my heart that .Net and Mono have the same problem. Java == true open source == large community == many implementations == many platforms. – Michael M Jun 20 '13 at 08:16
  • @ThorbjørnRavnAndersen: "The only alternative JVM project with momentum died when" -- I think you need to check you facts. – Michael M Jun 20 '13 at 08:20
  • @Michael.M Fact checked: Apache Harmony is retired (http://harmony.apache.org/). Feel free to check the actual activity of the JVM's on your plethora - you might be surprised. Regarding the JCP, well, after Oracle bought Sun it has just turned in to a facade. Also the common reason why open source JVM projects die, is because it is _hard_ to get 1) speed and 2) bug-free regarding the TCK. It was a pity Harmony died. – Thorbjørn Ravn Andersen Jun 20 '13 at 08:45
  • @ThorbjørnRavnAndersen: Harmony died over the difficulty in obtaining a license acceptable to Apache for use with the Harmony project. Even so there is still just **one** .Net vendor and **one** mono vendor. This is not the case with Java. That's unfortunate since I do love C# – Michael M Jun 20 '13 at 09:25
  • @Michael.M No, please get your facts straight. IBM stopped contributing (rumor has it they got a perpetual Java licence for doing so) and _then_ it died. http://en.wikipedia.org/wiki/Apache_Harmony#Disengagement_from_IBM – Thorbjørn Ravn Andersen Jun 20 '13 at 09:28
  • @ThorbjørnRavnAndersen: Honestly JavaScript and HTML5 might be better than any of these (depending on what the goal is). With something like Titanium you're covered on all mobile platforms (including BlackBerry - not covered by Xamarin/.Net); with JavaScript (although not pure) and Unity you're covered for game development on any console/mobile/desktop/browser; and with Node.js you're covered for a high performance NIO web server which can run on any OS. (Node.js is even used by MSFT) – Michael M Jun 20 '13 at 09:37
  • @ThorbjørnRavnAndersen: I never contested that IBM's cowardly bail-out wasn't a facilitator. The point I am making is that it was **not** "because it is hard to get 1) speed and 2) bug-free regarding the TCK" - thats just a lame excuse. I'm glad you brought up IBM. What did IBM ever invest on Mono compared with their investment in Java. Hmmm I wonder what that tells us. – Michael M Jun 20 '13 at 09:45
  • @Michael.M If you want to know that, I suggest you open up another question. – Thorbjørn Ravn Andersen Jun 20 '13 at 09:57
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/32071/discussion-between-thorbjorn-ravn-andersen-and-michael-m) – Thorbjørn Ravn Andersen Jun 20 '13 at 10:47
  • Completely disagree re: libraries. Yes, there are many available and some of them will do most of what you need, but they all have their own quirks, edge cases and problems. Usually coupled with little or no documentation. If you're working in a domain you're familiar with, you learn to deal with the foibles of each library, but for a new domain, it can take considerable time and effort to find the right choice. .Net libraries tend to be "cleaner" and more consistent IMHO, possibly due to how the framework started. No doubt it will head the same way as Java as more become available. – Basic Jun 04 '14 at 17:52
9

I've been asking the same question off-late and IMHO, .NET/Mono seems to be a better option simply because Mono has a great track record for cross-platform desktop applications (as opposed to Java) and of course, Mono is improving by leaps and bounds these days.

Swaroop C H
  • 16,902
  • 10
  • 43
  • 50
8

I'm going to say Java as well. If you look at it in terms of maturity, a lot more time and effort has been expended by Sun (and others) in getting the JVM to work on non-Windows platforms.

In contrast, Mono is definitely a second class citizen in the .NET ecosystem.

Depending on who your target customers are, you may also find there is real pushback against using Mono - does Novell offer the same kind of vendor support for Mono that you would get for Java or .NET on Windows?

If you were primarily targeting hosting your service on Windows, it would make sense to be considering this choice, but since you're targeting Linux primarily, it seems like kind of a no-brainer to me.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
warren_s
  • 977
  • 1
  • 9
  • 13
  • I tend to agree with Mono being a 2nd class citizen, but not with the conclusion. Java has been around a long time and is riddled with legacy quirks and memory management issue not, to mention that it almost always chooses the most verbose way of doing something. It's also been pretty stagnant (the language) for years and has only recently started to incorporate features which have been in .Net for years. IMHO, it's a choice between two evils... Flakey platform support w/ .Net or a lumbering behemoth that is very slow to evolve and a chore to code for. – Basic Jun 04 '14 at 19:02
7

Java was designed to be cross-platform; C#/.Net wasn't. When in doubt, use the tool that was designed for your purpose.

EDIT: in fairness, .NET was designed to work on embedded/PC/Server environments, so that's SORT of cross-platform. But it wasn't designed for Linux.

AlexeyMK
  • 6,245
  • 9
  • 36
  • 41
  • 3
    well, the C# is ISO standardized, so the idea was to have something cross-platform. microsoft didn't want to develop implementations for other platforms, but it's left to other parties as the language is a standard. the .Net framework is a more complicated story, though. – zappan Sep 14 '08 at 21:21
  • Mono is a good implementation though and DotGNU (for Mac too) – Andrei Rînea Sep 15 '08 at 10:21
  • 1
    zappan: valid point on C# (didn't know), but .NET is freaking huge. Admittedly I have no personal experience here. – AlexeyMK Oct 01 '08 at 03:42
  • @zappan - from a practical perspective, it's irrelevant that C# is standardised (or that Mono makes a pretty good clone of C#). Platform portability is about the entire platform (including libraries and tool ecosystem), not the just the language itself. In that sense .Net is definitely not fully cross-platform. – mikera Dec 20 '12 at 09:05
7

I think the answer is "it depends." Java runs on just about anything, but .NET/Mono are (IMHO) a better framework for the desktop. So I guess the answer really depends on what platforms you plan on targeting.

Giovanni Galbo
  • 12,963
  • 13
  • 59
  • 78
  • Desktop is not synonymous with windows even though it has the largest portion of the desktop space. – ZOXIS Apr 14 '17 at 12:58
6

To add a bit more to the conversation, Java is more portable if you remain about one version behind - Java 5 still has many excellent features so you can wait for Java 6 and still have a lot of range in terms of language and libraries to develop with. The Mac is the primary platform that can take some time to catch up to the latest Java version.

Java also has an excellent standards body that intelligently grows the platform based on input from many different companies. This is an oft overlooked feature but it keeps even new features working well across multiple platforms and provides a lot of range in library support for some esoteric things (as optional extensions).

Kendall Helmstetter Gelner
  • 74,769
  • 26
  • 128
  • 150
5

I would vote for Java being more portable than C#. Java definitely also has a very rich set of standard libraries. There is also a broad set of open source 3rd party libraries out there such as those provided by the Jakarta project (http://jakarta.apache.org/).

All the usual suspects exist for CI, Unit testing, etc too. Cross platform IDE support is also very good with the likes of Eclipse, Netbeans, IntelliJ IDEA etc.

4

There are other language choices too. I've become quite fond of Python, which works well on Windows, Linux, and Mac, and has a rich set of libraries.

George V. Reilly
  • 15,885
  • 7
  • 43
  • 38
  • Yeah, I love Python and it has Django which I like for web apps, but there were some things that made it inacceptable, the most important being the GIL in the standard C implementation of the interpreter. I have a number of operations that benefit greatly from parallel computing on multicore machines and I'd have to spawn processes to do that in cPython. – Hanno Fietz Jul 02 '09 at 12:24
3

While Mono has its share of problems I think it has a better cross-platform compatibility story especially IF you have reliance on native platform invocation.

There are not enough words on Stack Overflow to stress how much smoother it is to get something native called and executed in .NET/Mono on (at least in my experience 3...) multiple platforms vs. the equivalent Java effort.

Community
  • 1
  • 1
damageboy
  • 2,097
  • 19
  • 34
  • I agree, calling platform specific code from .NET/Mono is super easy as long as it can be called from C. With CXXI (pronounced sexy) it is becoming a cakewalk to call C++ code as well. http://tirania.org/blog/archive/2011/Dec-19.html – Justin Feb 03 '12 at 23:52
2

Gatorhall do you have some data to back that up?

Performance. Java and .Net have similar performance level due to the virtual machine, but JVM normally has better performance because of years and years optimization.

Background: I'm a Windows guy since Windows 3.1 and currently a Linux user (still running Windows 7, great OS, on a VM for Visual Studio 2010 and other tools).

The point: me and a lot of users (windows, linux, etc) I know, may disagree from you. Java tends to perform slower even on a linux desktop application, ASP.NET perform's faster that java server pages many of the times. Some may agree that even non-compiled PHP performs better i several scenarios.

Java is more cross-platform? I have no doubts about this (the history back this on), but faster (not saying .NET is) not so certain and I would like to see some real benchmarks.

Rui Marques
  • 3,429
  • 1
  • 22
  • 26
  • There is [another question](http://stackoverflow.com/questions/1610022/how-does-net-mono-performance-compare-to-jvm) that may help and of course there is the [language shoot-out](http://shootout.alioth.debian.org/u32/csharp.php). The JVM might be more heavily optimized but it is close (especially on Windows). Benchmarks for ASP.NET vs J2EE or JSP are even more suspect but I have no trouble believing that ASP.NET is much faster even if the runtimes tie. – Justin Mar 04 '12 at 09:59