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

Java Logo by Scriptol.com

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.

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);
   System.out.print(c);
} 

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.


Corretto and Microsoft versions

In response to Oracle's tendency to charge users of Java on the cloud, Amazon, one of the first players in the market with AWS, retaliated by launching Corretto, its own version of the JRE (Java Runtime Environment) based on OpenJDK.

Then the Oracle lawsuit against Google, which ended in a victory for Google and the clarification without recourse by the American justice that the use of APIs, Java or others, was fair and therefore without fees to pay, paved the way to developers.

To compete with Amazon, more than Oracle which is a minor supplier, Microsoft has decided to launch in April 2021 its own version of Java under the name Microsoft Build of OpenJDK. This distribution is completely free for businesses and will have long term support.

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.

Apache 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 allows also to program in PHP, C++, JavaScript and even editing HTML 5 and CSS code.

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 from the MIT, is a tool for creating Android applications mpore easily 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.

Compilers and development tools

Other tools