Java, for cross-platform applications - but not always free

Java Logo by

Java is now one of the most widely used programming language, mainly on networks and for web service.
It is a property of Oracle since 2009 but was built by Sun's programmers in 1995, in reply to the uncompatibility between various systems and libraries they have to deal with. The first version, named Oak, was targeted at embedded system, but with no success. The emergence of Internet gave the language another chance.

It was funded on the syntax of C++ remain familiar to programmers, but eliminates lots of drawbacks of this language.
Using Java rather than C++ improve productivity thanks to the language but also its complete standard collection of APIs, graphical and other.
Java Programs are slower that C++ ones, take a while to load, but they run under Windows, Linux, Mac and so on... The speed of the JVM has however been significantly improved over time.

You can also use other languages ​​such as Scala or tool of interface as JavaFX to improve productivity, they run on the JVM and use the Java libraries.
Java is not the safest language: according to the annual security report from Cisco, 91% of virus attacks on computers in 2013 have been through Java software, but through applets in the browser.

Java was used to time in conjunction with other languages ​​like PHP. We are able to calls Java classes from PHP to use its API. It is no longer possible since PHP 5, and also, as shown in the JavaScript section, we can do better with Node.js.

Apps for android mobile phones are made in Java, where it is be compiled for the Dalvik virtual machine.

So we can use Java:

  1. For portability, it works on the desktop, servers, mobile devices and virtually any operating system.
  2. For the JVM which also supports many other languages​​.
  3. To get a huge API.

Since the judgment of 9 May 2014 by the US Federal Circuit, the Java API is considered copyrighted. A judgment which could extend to other APIs. We can not freely use the library without being dependent on the owner. APIs are not subject to copyright in Europe and most other countries.

Oracle's traps

In 2016, Oracle suddenly choose to massively audit Java SE customers and some of them have been informed they have to paid 30 000$ for the use of Java SE on their computers. Source The register.
This did not apply to the users of the JRE runtime but it no longer exists in the version 11 of Java.
It is therefore preferable to use OpenJDK rather than the JDK provided on the official website or through RPM, because you will realize only after using the second in production that it is a paid software: Oracle salespeople will come to remind you.
The OpenJDK is free and you can use other languages on the JVM with this library. There is no difference between Oracle JDK 11 and OpenJDK 11 other than the license.

In April 2019, Oracle transferred maintenance of OpenJDK 8 and 11 to Red Hat, while still supporting the last versions. Red Hat was previously bought by IBM, this ensures the latter the durability of its products made in Java. Other big companies that have migrated to OpenJDK include Amazon and Alibaba.

A successor to C without C++ drawbacks

Java was designed to succeed to C and replace C++, without the disadvantage inherited to C++ or added to it.

Sample code

Merging and displaying lists.

String s = new String("demo");
for(int i = 0; i < s.length(); i++)
   char c = s.charAt(i);

IDEs and tools for Java

Since the version 3.7 of Eclipse, this development tool includes a new graphical user interface designer acquired by Google and offered to the foundation, WindowBuilder.
Like Dreamweavers, WindowBuilder has a bi-directional code generation, that is what we build in visual mode is translated into the source code and what is written in the source code is translated into graphics, this instantly without having to redisplay the page. It supports SWT and Swing.

NetBeans since 6.9 includes a composer for JavaFX. The JavaFX language is designed to easily create graphical user interfaces in Java, with a more visual approach.
The new version of the NetBeans editor offers it a graphical development tool.
It still allows to program in PHP, C++ and also editing HTML and CSS codes. But the goal is promoting JavaFX as a competitor to HTML 5, Silverlight and Flash to build web applications.

IntelliJ IDEA is similar to NetBeans, it offers various licenses depending on the type of application. It is a simple and complete tool for Java, JavaFX and other languages, and for mobile applications. Code assistance to HTML 5, Node.js and others. (Windows, Mac, Linux).

App Inventor, for creating Android applications with no programming. It is a visual development tool like Visual Studio where each component corresponding to a function on an Android phone has a block that you can set up and insert in the interface that you are building.
It is based on the OpenBlocks java library from the MIT. This should make creating an application very easy and quick!

Compilers and development tools

Other tools