views:

443

answers:

9

On Windows/Linux platform,I as a common computer user,could not nearly find any software written in Java.

  • The two operating system(Windows and Linux) are written with C.
  • The two web browsers(IE and firefox) are written with C++.
  • The two web server(IIS and Apache) are written with C++.
  • Most database management system are written with C/C++.

And I could not find software that was written with Java on desktop application area.It seems that programmers would prefer to use cross-platform Widgets(Qt,wxWidgets etc) rather than Java.

My question are:

  1. Why Java is not suitable to do kernel application?If the reason is its slowness,how many times is it slower than C/C++?
  2. Why programmers prefer C/C++ to do desktop application despite Java provides a consistent and excellent API library.I think it should requires less code using Java instead of C/C++ to develop most desktop application(e.g. card games) and the developed application could be easily deployed to other platform.
  3. Are there any famous applications done with Java from user aspect(means we use it every day)?

thanks.

+1  A: 

Why Java is not suitable to do kernel application?If the reason is its slowness,how many times is it slower than C/C++?

That's not really or not necessarily the only reason. Kernel applications like operating systems need access to the kernel and well the machine to which java can access is a virtual one.

Why programmers prefer C/C++ to do desktop application despite Java provides a consistent and excellent API library.I think it should requires less code using Java instead of C/C++ to develop most desktop application(e.g. card games) and the developed application could be easily deployed to other platform.

That's correct, but it turns out that in order to have a seamless experience in a desktop application you need to access to a number of native resources. Windows, Linux and OSX have their own complexities and most java application look out of place.

Working with the native libraries allows you seamless integration with the host system.

Yet, I think it is feasible to write all the common parts and the core of an application in Java and then add some native code for hooking properly in the host.

That's how IDE's like NetBeans, Eclipse and Idea are written.

About the browsers, and other major applications, the reason they are in C++ is not only its speed but the fact they are legacy code from decades.

Just to mention one recent example. Google Chrome, inherit a lot of code from WebKit, hundreds of thousands of lines. You can say they just did the "chrome" of the browser ( like that was an easy thing )

Are there any famous applications done with Java from user aspect(means we use it every day)?

Have you ever heard of gmail LimeWire?

OscarRyz
I though I said *any* as in *any in the world for anything* :P
OscarRyz
A: 
  1. Java is not suitable for kernel application because java runtime is not loaded then yet. Java runtime is installed on the OS and requires one to run. Plus it's slow as hell ;)

  2. Same reason as above. C++ is low level language plus it's much, much faster.

  3. Desktop applications... no, there are many web applications as mentioned, but I think most used desktop application written in Java is Eclipse, used by Java developers.

Fedor Hajdu
netbeans is written in Java also :)
Jichao
-1 That Java is slow is a (debunked) myth.
Aaron Digulla
Hello, 1995. Modern Java is generally nearly as fast as C++: http://shootout.alioth.debian.org/u64q/which-programming-languages-are-fastest.php ... Most of this is because Java can optimize during JIT (i.e. inline virtual methods) while statically compiled languages can't. JVM startup is still slow, though.
Robert Fraser
@Aaron Digulla (and his upvoter) and Robert Fraser: If you include JVM startup time, Java is still slow. This doesn't matter in server apps but is VERY noticeable in desktop apps.
Carl Smotricz
Myth or not, try it out. Boot a computer, and start a c++ and java app, see which starts faster ;)For web it's fine, for desktop (that's what we're talking about) it's slow, way to slow.
Fedor Hajdu
As for 1, bootstrapping a C++ kernel is much the same as bootstrapping a Java kernel.
Tom Hawtin - tackline
+2  A: 

I question your use of "kernel application", I think there's no such term. Either some code is part of the operating system kernel, in which case it usually HAS to be written in the OS's language, or it's an application, in which case it could be written in any language the OS supports.

Now there are much used, perhaps "essential" applications, which some people might call "core" applications, like browsers, DBMs and so on. Maybe that's what you're talking about.

Most applications have a visual interface. All the C/C++ programs have a look and feel that's more or less common and shared (a few common toolkits), and can be modified to some extent via settings in the operating system. Java (usually) "does" its own look and feel, and it usually looks a lot different from the otherwise common look; many people consider it ugly.

Java's performance is meanwhile well on par with C applications, but that doesn't include JVM startup. It takes a relatively long time for Java programs to start up, and users hate waiting.

A handful of database engines are written in Java. Derby comes to mind, and I think HQL. But that's not software users see a lot. Similarly, Web application servers Jetty and Tomcat are written in Java, and of course enterprise application servers such as WebSphere, WebLogic, JBoss, GlassFish. But again, these aren't user apps.

Carl Smotricz
(a) The *language* is irrelevant to the OS, both in kernel and user mode. In the end it's all just machine code executing. Of course, if you want Java in the kernel, then you'd need a JVM in the kernel, but theoretically it's possible (though maybe not a very good idea). (b) SWT is a Java GUI toolkit making use of native widgets. Swing isn't the only player there and remember that GTK and Qt for example are C/C++ toolkits doing all rendering themselves too.
Joey
Right you are, of course. In glossing over some details I in fact introduced incorrect information - sorry! SWT, though: Java desktops apps are rare enough, but Java SWT desktop apps, not counting Eclipse, are...?
Carl Smotricz
Haven't seen it much. Google Web Toolkit uses it for local hosted mode but apart from that ... don't know. http://en.wikipedia.org/wiki/Standard_Widget_Toolkit#Applications lists some examples, though. The much-cited Vuze is apparently SWT too.
Joey
+7  A: 
  1. There are at least some operating systems implemented in Java, namely JNode, JOS and JX. Of course you won't see any OS that started its history before the dawn of Java to be implemented in that language. Furthermore there seems to be a long-time bias against managed languages for an operating system kernel; there are some research projects such as Singularity that try the feasability of such an approach but we're nowhere near a point where this is ready for “normal” use. However, you will always need a kernel “core” which is done in assembly or another low-level language which gives you access to parts you wouldn't normally have. But this can be kept very small.

  2. Whether the Java API is consistent or excellent may be debatable, but for many environments the preferred languages are either C (UNIX-likes mostly, many parts of the Windows API), derivatives such as Objective-C (Mac OS X) or C++ (COM-based programming on Windows, KDE, Qt). This doesn't mean you couldn't do this in another language but the documentation usually assumes that you stick to the preferred languages. Another big factor you're apparently counting out is that you would require a JVM on the target system. The only operating system that ships natively with Java that I am aware of is Mac OS X. So you would bother users with additional dependencies. Corporations such as Microsoft are also very reluctant to even consider releasing 3rd-party software they have no control over with Windows so you'll never see a JVM being released with the OS there. (Yes, there once was a Java 1.1 one, iirc but those days are long gone and won't likely return. Also that one was supplied by Microsoft themselves.)

  3. Most Java developers probably use at least one from day to day, Eclipse and Netbeans for example are written in Java. As are some other software development tools, such as Maven or Ant. Another popular program is for example the Vuze (formerly Azureus) BitTorrent client. But at least for me there currently aren't many Java desktop applications I even use on a weekly basis.

    It's entirely different for web applications, though, as you can't really tell what they're written in from the outside.

Joey
+1, excellent and thorough treatment!
Carl Smotricz
JNode (http://www.jnode.org) is a better example of a Java OS that JOS in that it *actually works*.
Stephen C
Thanks, added it. I've never tried any of them but faintly remembered there were some. So it was mainly a quick search journey.
Joey
+3  A: 

One of the best-known applications written in Java is probably Vuze (formerly known as Azureus), a bittorrent client for Windows and Linux.

Bombe
+2  A: 

Why Java is not suitable to do kernel application?If the reason is its slowness,how many times is it slower than C/C++?

Java is a running on a virtual machine. To make it run somewhere, you must port this kernel (which is written in C++) to the platform. The main reason for this is that there is currently no (widespread) CPU which can understand Java natively. The common CPUs only understand assembly.

Today, Java is as fast as comparable C/C++.

Why programmers prefer C/C++ to do desktop application[...]?

Because Microsoft doesn't support Java (at least not in the same way as, say, C#).

Are there any famous applications done with Java from user aspect(means we use it every day)?

Most services on the 'net are written in Java. A lot of software on your mobile phone is Java. With the advent of Qt Jambi and SWT, Java apps look and feel like any other kind of app (including the insane startup times), so this isn't as obvious anymore.

Reasons why this isn't advertised much is a) people still believe the "Java is slow" myth and b) people don't care in which language something is written. They care whether it works for them. Plus, Sun really blew it when it comes to deployment. To create a Windows installer from VisualStudio, you just have to click a button. For Java, it takes writing startup scripts, license issues, size issues (do I include the JRE or not?), the fear that you can't have more than a single Java installed on a PC, etc. Also, applets didn't really help to gather positive feelings for Java.

Aaron Digulla
FYI, Qt Jambi has been discontinued by Nokia: http://qt.nokia.com/about/news/preview-of-final-qt-jambi-release-available
Hostile Fork
+5  A: 

1.
Java is not good for kernel development. The main reason is control. It's not just about speed (although that is a part of it). Java doesn't give programmers the same amount of control over memory, over exactly how their code is executed. In C/C++, you can usually guess exactly which assembly code will be created, based on your code. Not so in Java.

Note: This is true of C, and also of parts of C++: If you're using a lot of higher-level functionality in C++, you obviously have the same loss of control. But C++ gives the option of going either way.

2.
C/C++ is more used than Java for desktop for many reasons. Probably some of them are historical (they have been used for much longer), probably some of it is the problem of "Look and feel", which basically means that Java programs tend to look like Java programs, and not like most programs on the user's machine (there are solutions, but this used to be true of almost all Java programs, which made programmers stay away).

But the most important thing to understand, I think, is that C and C++ are also much less used for GUI nowadays. Obviously they're still used, but a lot of programmers are moving on to other languages, like C# and others.

3.
If you're talking about famous desktop applications, I think the most famous (certainly for programmers) is Eclipse. It's also a really great application, and certainly looks great, which just goes to show you that Java can be used for good natural-looking desktop apps.

I'm not really aware of any others.

Edan Maor
Regarding #3 – for other examples, see http://stackoverflow.com/questions/521110/examples-of-good-java-desktop-applications. Personally I can say that IntelliJ IDEA is an awesome desktop Java app.
Jonik
A: 
  1. Java is not suitable for writing kernel programs because Java programs are designed to run under a virtual machine instead of the underlying OS natively. Under a virtual machine, what we can do will be limited in exchange of higher security. Whereas speed is hardly a main issue here.

  2. I'm not sure for other developers out there, but my personal experience is, despite the fact that Java is claimed to be "write once, run anywhere", there are quite a few inconsistent behaviors of the JVM under different OSes. To overcome those inconsistencies, developers may have to put workarounds in their programs to deliver unique user experience. In the worst case, it just can't be fixed without modifying the JVM itself. As a result, doing the cross-platform base with C/C++ libraries could be less painful because you'll have control of all the components you write.

  3. There is a bittorrent client named Vuze (used to be Azureus) which is quite famous IMO. You can take a look here.

shinkou
A: 

Have you heard of Limewire ?

Salvin Francis
There are also complete 3d softwares made in Java. You of course cannot expect java to be used to make System programs since its platform independent (of course not "MS"'s definition of platform independent: being able to run in all windows systems)
Salvin Francis
Now that you mention it, I just remembered Runescape. Very popular MMORPG, and it's a 3D Java applet.
Carl Smotricz