tags:

views:

1053

answers:

15

Why would you choose java over others? Why did you choose java to program your application?

Please include what you are using java for (desktop application/ web application/ mobile).

+3  A: 

Java provides a very rich API right out of the box and hands-down produces the most portable applications since there is a Java VM for almost every platform.

BTW: I haven't used Java since I left college since I work for a Microsoft shop, but I can't think of a single thing I can do in C# that I can't do in Java, whether it be enterprise applications, web applications, or desktop applications.

IAmCodeMonkey
Active Directory integration is obviously a little clunkier.
tvanfosson
unsafe code blocks for pointer manipulation
Steven A. Lowe
C#'s newer versions have surpassed Java in features (lambdas and such).
Herms
Run on linux? Develop for Android? ;-)
johnstok
What reason is there for C# or java having lambdas? neither language is based around them, it's just another structure to waste time learning when its not needed. I'm not being confrontational, if there is a reason I would like to know the reason why.
WolfmanDragon
WolfmanDragon: Sounds like a new question for Stackoverflow.
Jonathan Arkell
Good point. thanks
WolfmanDragon
+17  A: 
  • Excellent tooling: IDE, CI, etc.
  • Vast array of 3rd party libraries.
  • Huge amount of documentation available.
  • Large pool of developers available.
  • Platform ubiquitous.
  • Excellent performance.
  • Excellent specification.
  • Sturdy garbage collection.
  • Managed memory.
  • Native threads.
  • Choice - implemented by multiple vendors.

I have used Java to build various middle-ware products: Inventory mgmt; CMS; chemical registration; etc.

johnstok
A: 

Using it for desktop applications.

Excellent IDEs available, wonderful API, "C-style" syntax makes it easy to pickup. Once the JVM starts, the performance is great.

Brian Knoblauch
+3  A: 

Things not yet mentioned:

  • Cross-platform Desktop Application, even with sophisticated GUI
  • bunch of tools
  • static typing (see GWT)
  • error messages at compile time
  • very clear error messages
Davide
Note that programmers are pretty evenly divided on whether static typing is good.
Just Some Guy
The question asked why you would pick java, and that's one of the answer (and that's why I linked GWT as an example). Of course static typing might be a reason why you *don't* pick java as well :-)
Davide
Oh, I know. Just sayin'. :-)
Just Some Guy
A: 

I use Java for our BPM platform and used Java in the past for enterprise web apps.

It depends on what you want to do. Considering language features, libraries available and IDE experience, I personally would choose C# over Java. C# 3.0 has many useful features that Java lacks, such as LINQ, Lambda expressions, etc. Some people prefer the huge library choice that is available for Java, but I think there are just too many ways of doing things. Java IDEs like Eclipse and NetBeans are getting better, but I think Visual Studio is still much easier to work with.

Of course,if you are not using Windows, you don't have much of a choice but to choose Java. Ruby and Python can be good options for things like utility apps and GUIs, including Web apps, but for enterprise apps that don't use Windows, Java is pretty much the only option.

Denis Fradlin
Regarding non-windows enterprise development, Mono works very well for running .Net framework applications, so saying that Java is the only choice for enterprise apps is very much incorrect.
cdeszaq
What is your BPM platform Denis?
OscarRyz
+2  A: 

Portability is the key to java. I know that a program that i am coding will run on any system, there is no need to create different releases for different OS's. Java also offers built in security, making the coding of the safe programs easier.
Java is fast, with clean code java is benchmarking in the same range as C++.

C# is the language that gets compared to java the most often. C# isn't as portable as java, and has very few features that java doesn't. This makes java much more attractive unless the program will ONLY be run on a single OS, in that case i might code it in C++.

WolfmanDragon
+10  A: 

One of the nice things about Java is that everyone knows it. Of course, now that I've said that, I'll get 80 comments from people claiming to have never learned the language. Be that as it may...

Like it or not, Java is the closest thing to a lingua franca (the idiom means "common language") we have in the industry today. Just about every has either used Java at some point, or (more commonly) is actively using it now. That sort of ubiquity can be extremely attractive to some companies, particularly those reliant on consultants. If you start a project in Java, you're pretty much guaranteed to be able to find talent to maintain the code base for years down the road.

On a different tack, Java is an excellent language for developing cross-platform desktop applications...it's just that nobody knows it. Most of Java's dominance is on the server side coupled with a little bit of love from the J2ME crowd. However, if you objectively consider Swing in Java 6uN, it's hard to find a better tool for the job. Don't get me wrong, I see that it has its flaws, but many of those have been fixed in recent releases. Most of the issue now is mindshare: everybody knows that Java is slow and ugly (neither of which is strictly true anymore). The other problem is that Swing is very much a cross-platform UI toolkit. This means that it is inherently much harder to create professional UIs in Swing than in Cocoa or even WinForms.

Finally, a really great reason to pick Java (as opposed to .NET or Objective-C) is the ecosystem. Other answers have mentioned libraries, which really deserve a significant spotlight; but I'm thinking specifically of the rising language diversity. If you write an application in Java today, you can seamlessly transition to Scala at any time. You also have the option to do scripting in Groovy or JRuby, not to mention taking advantage of the powerful concurrency abstractions in Clojure. Because of its portability and high-level nature, the JVM is increasingly the preferred target for language compilers and interpreters (even more than the CLR). Java is really at the center of that nexus, not really benefiting directly from the vast cloud of languages which swarm around it, but certainly deriving value from all of the interoperability, present and future.

Daniel Spiewak
Some good points about swing. I use swing every day and didn't even think of it as a plus.
WolfmanDragon
+1  A: 

I switched from years of C++ to Java because I was working on higher level stuff and needed the benefits of memory management, reflection, and sandboxed execution that I get with Java.

I have tried COM in the late nineties and could not touch it.

.NET looks promising and in many ways is now much better than Java. Unfortunately, being window-centric is a complete dealbreaker for me.

Uri
+1  A: 

Another benefit is the awesome static analysis tools available e.g. FindBugs. These perform a lot of checking on your code above and beyond those performed by the compiler, and can help identify bugs and/or code smells before testing begins.

Don
A: 

Why would I choose Java? If I happened to have a team of replaceable code monkeys developers that knew Java better than anything else, that is probably what I'd go with.

runrig
+2  A: 

1) Very good and free documentation
2) Very good developer commercial and free tools
3) good certification and training resources
4) good runtime and free tools
5) good profiling and monitoring tools
6) very good support options from various companies
7) very good open source community with huge amount of libraries

anjanb
+1  A: 

Lots of great reasons have already been mentioned. I'd like to add the political part. I trust Suns language a lot more than Microsoft alternatives. It's not because I hate Microsoft, it's just that Sun is going a direction with Java that I really like, and Microsoft is going a direction with .net etc. that I really don't like.

This is very subjective, I know. But to me it seems like Sun really want to create a great language, and try to make money somehow. While Microsoft seems more interested in making money by vendor lock-in and systems that looks great and feels great, but may not be as good as it looks in the long run.

So the way Microsoft is handling it right now, I don't even care about how good or bad it is, technically. I don't care, I'm not going to use it.

Java has everything I want from this kind of programming language, including all the boring political stuff most people just skip. I don't know about any other current language that has all that.

myplacedk
A: 

Why would I choose Java - is it the most popular language out there right now? If not, it's gotta be damn close, so if I'm building a product I might choose this because it would be the easiest to hire developers for.

Why did I choose Java - because it's what I know best.

bpapa
+3  A: 

My reasons for prefering Java over other programming languages at this time are:

  • price - it's free
  • performance - really fast these days thanks to the HotSpot JIT compiler
  • effectiveness - lots of power with rigorous features like type-safe, sand-boxed, etc.
  • OOP capability
  • very good, well-thought out exception handliing; C++ exceptions are the opposite!
  • portability - it runs on almost everything
  • tool availability - awesome IDEs like Eclipse & NetBeans are free, as are web servers like Tomcat and application servers (JBoss, Glassfish, Geronimo, etc.)
  • flexibility - does graphics, desktop GUIs, web user interfaces - all kinds of things in all kinds of runtime environments
  • aptness - many enterprise apps today have to support HTML, SQL, and XML - Java has good support for all of them built in and you can get third-party libraries for free that make this even easier/better
  • well-supported - Sun keeps adding improvements and fixing thing going one or two versions back
  • forward compatibility - unlike something like VB which undergoes wrenching change in its syntax every couple versions or so, Java's syntax and semantics seem about 99.9% upward compatible from version to version

I have been writing programs in Java for over a decade and I am pretty satisfied with it. I have used other languages for almost two decades before that. So I am not biased by describing the one thing I know - it is one of many languages I know intimately.

When upgrades to the JDK/JRE come out, I look the documentation over to see what is changed. Sun is good about telling/explaining this. I have never had an extremely rough time porting from one JDK to the next.

When I have switched from one OS to another as my main OS at home or at work, it has not caused a problem for the Java applications I write - or the tools I use, generally. The one exception is Borland JBuilder, which some Borland marketing or technical genius decided to frequently stop supporting. Eclipse and Netbeans run terrifically on the Mac and probably always will. I have used Java on:

  • MS-Windows 95, 98, NT4, 2000, XP
  • Sun Solaris/SunOS Unix
  • IBM AIX
  • Mac OS X
  • Linux
  • Motorola cell phones (MIDP, CLDC)
  • Palm Pilot PDA

Java VMs (virtual machines) are everywhere! They are in:

  • web browsers
  • cell phones
  • PDAs
  • desktop computers
  • web servers
  • application servers

I have written programs on all of these. All you have to do is get an IDE with the right plugins, get the API documentation for the target environment you want, and start programming.

The GUI programs I write actually do look & work correctly on different platforms! I cannot tell you how long other vendors promised to do and how often/long they have failed. Just look around, some still exist.

Sun promised this in Java 1.0 and they sort of delivered it with AWT. However, the abstract windowing toolkit used native GUI components and the differences between these components (which followed no unifying standard at all) were too great to get same/nice look/behavior on all platforms.

Sun delivered very well upon this portable GUI promise when the Swing GUI API was delivered a decade ago, back in December 1998.

JohnnySoftware
+1  A: 

Please don't follow blindly all java-entousiasts. Java has its own flaws. Java is great for rapid development, enterprise oriented stuff, and "high productivity" project (with the tons of projects, community,...). And if one guy show me a benchmark highlighting how java code can be as optimal as C stuff doesn't mean the complete java solution is fast and lightweight.

Java will never find its way on some performance critical applications, like games, codecs, web browser. No major game software is developed in java, and not because the developper are not capable of writing one piece of Java code that has the same speed as C or C++, this is because the very limitations of the language involves that performance and memory consuption will never reach a good C/C++ code. Takes VisualStudio and Eclipse. Java is great for one stuff (productivity stuff, enterprise middleware), but if you want to write codecs, games, performance critical libraries, you'd better try knowing C. But, one the other hand, you'll write the java code faster and safer, with C and C++ you're taking more risk (pointers!) and this takes usually more time.

And don't forget the joke "Write once, Debug everywhere", this is actually true. You have to deal with different JVM implementation nightmare with Java.

Other programming language have their interest, bash/python scripts for local scripts (repetitive action, fast and quick UI,...). Php or ruby for webapplication are very well deployed and documented on the web.