The following discussion is only for PC-side and mobile-side.
It used to be, but it's not anymore.
There are cross-platform requirements for only the client application, not the server. For example, the desktop app, your customers may be Windows users, or Linux users, this time if you do not want to invest more cost to adapt to each platform, then Java so-called "Write once, run everywhere" is very glorious. Today, however, the entire software world is dumping to B/s application (except for embedded), even if you want to do the client cross-platform, QT and other third-party framework is far more powerful than swing, Java is basically eliminated in the Desktop application field is an indisputable fact, Java has been proud of the applet has long since disappeared. If the client Java has a little bit of good, it's only Android. Android initially did not rely on the JVM to shield the differences between different hardware devices and achieved great success, but today, the advent of the art mode in Android L is also about to subvert this situation, And Google may want to replace Java with its own go language as the first language for Android. So on the client side, Java almost failed.
server-side applications do not require cross-platform. do a Web server, I think no company today with Linux, next month will change Windows? If you are simply replacing a Linux distribution, such as from Debian to Fedora, the Linux kernel is inherently immutable, so a purely compiled type of language like C + + is no longer a problem. If I were a game server, I would almost always choose Linux instead of the win platform. The practicality of Java's cross-platform advantage has been greatly weakened, it can be said that in practical applications is not obvious, in general, almost no sense of Java can also cross-platform this feature. Jrockets, one of the three commercial JVMs, is a compiler-only JVM, which, when the application starts, compiles all bytecode into local machine code, which in fact largely abandons the cross-platform and pursues performance.
Today, Java's greatest strength lies in its vast and well-established ecosystem. whether a programming language can be popular is largely determined by its ecosystem. The improvement of the Java ecosystem is mainly embodied in the following aspects:
- Java has the largest number of programmers in the world. you say they are farmers, but the number is there, the most obvious effect is that when hiring a company will be easier to recruit Java programmers. Imagine that if you want to make a software, you have a great technical solution that needs to be implemented in languages such as C++,scala or Ruby, but without enough manpower, the plan will probably be ruined. This time your application Java can do it, and it is easy to recruit enough people, then you choose Java is more likely.
- Java has a large number of third-party class libraries. If you want to parse the HTML, you probably only have to write your own analytic library in a C + + language, and if it is Java, you can easily find jsoup on GitHub, and use MAVEN import dependencies to take care of HTML in minutes. There is another irony in Java: "We don't produce code, we're just GitHub's movers." "This sentence literally makes sense, but ignores the enormous value that is brought about by the increase in software productivity." For software development, the company's only cost is actually "charging", every one months to reduce development time, can help the company to save hundreds of thousands of tens of millions of of research and development costs.
- Java has a powerful IDE. Eclipse, the plug-in can meet almost any need you develop. It's slow, but you can improve the flow of your program through JVM tuning, and never use the default JVM parameters. However, IntelliJ idea has completely surpassed eclipse, and idea's intelligence is almost comparable to that of win platform vs. I'm the kind of person who can't live without vim, and there are vim plugins in all two of these ides to make me live happily ever after.
- Java has many killer apps. Needless to say, Spring, Struts, Hibernate, Hadoop, Tomcat, JBoss and many more. See my answer on the understanding
- Java has very few grammatical features. Yes, this is also an advantage. C + + has added a lot of features, learn to trouble not to say, use it will also reduce code readability, in fact, it is a time not to please. In today's world, the requirements of programming languages are simple syntax, code readable, and performance is back to the second, so the birth of Python, Ruby and other programming languages. A lot of people criticize the Java syntax is very bloated, I admit it, but the fact is, programming language has never been because of the syntax bloated and eliminated, the decision of its life and death is the ecological system. for critics, quote the word: " dynamic type is cool, code refactoring crematorium "
Java's performance is high enough. Sun/oracle's hotspot JVM's built-in JIT compiler has made a great effort to optimize bytecode at runtime, with sufficient "preheating" of the JVM after the server application is started, and reasonable startup parameters. Java is fast enough if it is not a system class application that is sensitive to performance. There is a simple and workable way to see this visually, adding a busy view of the JIT compiler in the JVM startup parameters +XX:PrintCompilation
. In today's world, the demand for software is increasing, and in the case of acceptable performance, the development efficiency is the first, which is the main reason for the popularity of the dynamic scripting language such as Python.
Above only do objective analysis, and do not want to cause the language war. After all, there is no best language, only the language that best suits a particular project. quoting Hegel's sentence: " existence is reasonable." "
Does the biggest advantage of Java really lie in cross-platform?