Java is a cross-platform interpreted programming language that should be run within a Java platform installed in a personal computer or server.
Java was originally released in 1995 by Sun Microsystems. In 2010, the company was acquired by the American company Oracle, so that as of 2023 is the owner of Java.
This post is an introduction to the Java platform and programming language. It may derived to other posts within this blog that extends info on the topic.
Java Programming Language
Java programming language is a high-level, class-based, object-oriented, cross-platform, interpreted programming language. It is one of the most popular, specially in cross-platform applications and business environments.
As an overview, Java source code needs to be compiled, generating what is known as Java bytecode. This bytecode can be run on any machine that has installed a virtual machine, that in the case of Java is called Java Virtual Machine (JVM).
Java source code is stored as Java files, with .java extension. Compiled Java bytecode is stored as Class files, with .class extension.
Just take note that Java bytecode could be run on virtual machines different to JVM. For example, latest Android devices run Java bytecode on Android Runtime (ART), optimised for Android portable devices, instead of JVM. ART run .dex files, that are .class files that has been recompiled in an extra step.
To know more details about the Java programming language and get tips, you can check this post.
Java Platforms and Components
This article is recommended to get a full understanding of Java Platforms and apprehend the (sometimes confusing) concepts of Java SE, JVM, JRE, JDK or OpenJDK that you will find throughout Java documentation and the current post.
Java Executable Files
In this section, we are reviewing two types of executable files:
- Cross-platform Java executable files
- Self-contained Java executable files
Summing up, there is a trade-off between cross-platform and self-contained executable files. Each type of executable files offers one of these characteristics while sacrificing the other.
Cross-platform Java Executable Files
Compiled Java programs have the form of Class files (.class extension). This is the most basic way to deploy a Java program.
When there are many files involved in development (various Java source code files, images, sounds, folders, etc.) it gets burdensome to deploy all of them to the users. Because of this, developers may look to generate a single executable file.
A JAR (Java ARchive) file is an executable file with the .jar extension that assemble all program resources within a single file. This eases the program distribution while keeping cross-platform capabilities. JAR files can be generated during program compilation.
To create a JAR file, you can follow the instructions of this post.
I remind that Class files and JAR files contain Java bytecode that cannot be directly executed by the OS, and a JVM installed in the computer is required to run this code. Because of this, Java programs have the disadvantage of requiring a pre-installed JDK/JRE software on each computer.
On the other hand, Java programs can be run on any device that has a JVM.
Self-contained Java Executable Files
Self-contained Java executable files get rid of the JVM software dependency of Java programs, while sacrificing the cross-platform aspect of Java programs.
One option to create a self-contained Java executable file is JPackage utility, that is available from OpenJDK 16 and versions above. It allows to create a self-contained native executable file for a specific OS.
To know more about how to create a self-contained Java executable file, please check this post.
Creating your first Java program
If you want to create your first simple Java program, you can follow the instructions on this post.
There are official free Java training courses available for Java 8. You can find Java program examples on this external link. Some examples available as .jnlp files, based on Java Web Start (JWS), so you may need to install IcedTea or OpenWebStart in order to be able to run them.
Note: If you want to read more about JWS compatibility, you can read the JWS section of this post.
There are also courses from Oracle University. The starter level is for free, but you need to pay for advance levels. You can find them on this external link.
Java Certifications for Professionals
Oracle offers different Java certifications for professionals. They are available on this external list.
There are plenty of Integrated Development Environment (IDEs) that are compatible with Java.
Java IDEs featured on this post:
- Apache NetBeans
- IntelliJ IDEA
To read about Apache NetBeans, please check this post.
java command-line tool executes Java applications.
javac is a Java compiler. You need to introduce source code files as input and it gives .class files as output.
javadoc is a tools that generates Java documentation, based on the source code and comments added to it.
javap is a command-line tool that can be used to find the version on which a Class file has been compiled.
You can find more information about javap tool on this external link.
Java libraries are usually distributed as Java Archive files with .jar extension.
Java Libraries for Video Games
Some Java libraries for video games are LWJGL, libGDX or jMonkeyEngine.
To read more about Java libraries for video games, please check this post.
Java Build Automation Tools
To read more about build automation tools for Java, please check this post.
Communities are helpful in case you need help or share opinion with other users and developers.
- Reddit r/Java
- Reddit r/JavaHelp
- Java Programming Forums
Reddit has one channel to discuss about Java, called r/Java.
This channel is to discuss features, news, etc., not to get help. If you need help, go for r/JavaHelp.
Reddit channel to get help about Java.
You can leave a message at Stackoverflow and tag it as “java”.
Java Programming Forums
Java Programming Forums is one of the biggest forum about the topic, before the arrival of general platforms like Reddit or Stackoverflow.
javaHispano is probably the biggest Spanish-speaking Java community.
Oracle Developers Community
There is a Java section within the Oracle Developer Community.