In recent weeks, within IT circles, it has been much discussion of Java Oracle and Google Android. This is an issue that affects us in full (we are forming Java-Oracle and Android developers) and it is why there have been many people who have presented us with several questions: What is Java precisely, a language, a virtual machine …? Is Java free? Where does all this in Android? Android is Java?? Does a Java application as is in Android? Android is free?? …
With this article, we will address simply and purely technical vision with these issues: discuss what Java technology and its component parts, then about the Android platform and finally let their clear commonalities and differences.
What is Java?
What is generically known as Java covers a range of technologies based on several concepts:
- A programming language with which to write applications.
- A set of libraries that make working programmers. Major APIs from Sun are divided into 3 main sections:
- Java SE: targeted at desktop applications, applets, …
- Java ME: focused on consumer devices with limited resources
- Java EE: for enterprise applications (web, distributed)
- Some tools (JDK) to build applications from source code.
- A virtual machine that can run an application on any computer (JVM).
This last point, portability, which is defined as Java technology: a single application can run anywhere, whether on a Windows, Linux, Mac, mobile phone, browser or operating system to a Blu -ray!
That’s an incredible amount of different teams, how does Java be as portable? The secret is in the virtual machine.
A program written in C or C + +, is generally dependent on the platform (processor, operating system, etc..). Instead, Java programs are compiled into an intermediate format called bytecode. The bytecodes are-usually-not directly enforceable by any platform. However, a special program, the virtual machine can translate them into machine-readable code for the device on which it is running.
Of course, to run a java program on a computer need to first install a virtual machine.
Virtual machines and standards
What Java virtual machines on the market? The best known is HotSpot, Sun Microsystems released it under the GPL in 2006. Throughout these years, in what is known as OpenJDK project, have been releasing or replacing other components of Java, until all the elements missing to make the technology completely free. Thus, the reference implementation of the next version of Java will OpenJDK7, 100% free.
There are other virtual machines capable of interpreting bytecode, such as free or J9 Kaffe project, IBM.
But if a manufacturer creates and implements its virtual machine operating system or mobile device, how is it possible that Java remains portable? Thanks to Java specifications or standards (known as JSR) are both available technical documentation as evidence for each of the components that make up the Java technology.
So every company phones-for example, Java is able to adapt to their operating systems, making it behave like other models.
Similarly, major libraries are standardized so that a program behaves like whoever the creator thereof. Apart from official libraries already included in OpenJDK, there are free implementations of other APIs, such as GNU Classpath (free GPL) or Apache Harmony (Apache license free).
Traditionally, mobile devices have not had as much power as desktop computers. Therefore Sun Microsystems created a limited version of Java called Java ME libraries (Micro Edition), distinguishing it from Java SE (Standard Edition), which is the full version.
Java ME and Java SE also differ in some aspects in your virtual machine and language because, although the operation is identical (syntax and interpretation of bytecodes) Micro Edition virtual machine only has a subset of the functionality of its sister greater. Of course, these changes are documented in their respective JSR.
Google sought to compete in the segment of smartphones to position their search services. The Open Handset Alliance, a consortium led by Google itself and other major manufacturers such as Intel, Motorola, Samsung and HTC, released in 2008 its Android operating system. Its nucleus was used based on Linux and many other open source projects like SQLite or Webkit.
The entire platform is distributed as free software, but Google itself or some mobile companies often add non-free applications like Google Maps.
Regarding the development of applications, wanted to be comfortable environment for programmers, and porting existing applications to be as quick and easy as possible. That is why we chose Java as a very popular language, which existed many applications written, and several graphics integrated development environments.
However, using Java ME involved the purchase of licenses to Sun Microsystems and according to them, was not prepared for the next generation of smartphones. On the other hand, using the virtual machine and the Java SE API directly, which had not been optimized for small devices-not adapted to the needs of Android.
It is for these reasons that Google developed Dalvik virtual machine.
Dalvik is the virtual machine that allows you to run Android applications. But it’s not really a Java virtual machine. Explain how the process of developing an Android application:
Google tools let you compile Java code into bytecode. So far it behaves like any other Java development kit. However, the bytecode, in turn, is converted into the binary format of the machine Dalvik. Dex. The Dalvik virtual machine has major differences with HotSpot. For example, it is optimized for low memory use (this is possible because it is a machine based on records and not on battery) and is designed to run each application isolated a different virtual machine.
Thanks to the Apache Harmony project, in addition, Android provides a relatively complete subset of the Java SE API. Thus, creating java applications or carry, whether in source code or binary format will result in some cases trivial.
However, the Google API is not 100% compatible with that of JavaSE. Libraries such as the GUI (Swing, Awt) are not available on Android. In addition, concepts such as safety management have been completely reinvented.
The Dalvik virtual machine raised the suspicions of Sun Microsystems not use a standard Java platform as it was ME, SE and JavaFX. The bytecodes of an Android program is not compatible with the Java specification, which contributes, according to the Sun-market fragmentation.
The result is a platform that is not strictly “Java Technology” simply uses the Java language as a basis for building applications.
Android and Java are two different platforms sharing language and basic programming libraries.
In any case, more than ever, this programming language is present in virtually all environments, from the desktop, the web and mobile devices, in any of its variants.
Whether you’re a Java developer (in all layers) and Android, the “SL-275 Java Programming” course is ideal for more robust way the Java language and its libraries, or to learn the language from scratch if you have some prior knowledge of object-oriented programming. A course is also recommended preparation for the Sun Certified Java Programmer (SCJP) certification.
About Warp Networks
Since 2004, the Aragonese company Warp Networks is a leader in open source technologies applied to three areas of service:
- Software Development and Integration
- Technology Consulting
- ICT training
Warp has worked in various development projects related to mobile devices and communication networks including 3G-Android-operating system both application-level and high-level systems.
Warp is also technology partner Oracle and eBox Technologies, which enables him to deliver official courses MySQL, Java and Zentyal.