Java: A First Look
The course is part of this learning path
Java is a very popular and powerful type-safe language, used in many areas including general software development, large complex enterprise systems, mobile development, IoT devices, etc.
Knowing and understanding Java will help you succeed as a developer within many industries. Well, Java is more than just a software language. It’s a platform that provides many features. The Java platform not only runs on computers but it is equally at home within Cars, Cards, Rings, PDAs, and many other physical devices. The Java platform was developed early on with the explicit intention of being a portable technology, being agnostic of any underlying operating system - and therefore being able to run in as many different places possible. This is and has been and always will be one of the main motives to consider investing in Java.
This training Course introduces you to the Java Platform, the Java SDK, and Eclipse as an IDE for creating and managing Java software applications.
You will learn:
- What Java is
- The Java tooling and which tools are used for tasks such as compiling, running, and documenting Java programs
- The different versions of Java
- The JDK structure
- How to create a simple Java class
- How to compile and run a simple Java application using the javac and java tools
- Eclipse for coding Java programs
- A basic understanding of software development
- A basic understanding of the software development life cycle
- Software Engineers interested in learning Java to develop applications
- Software Architects interested in learning Java to design applications
- Anyone interested in basic Java application development and associated tooling
- Anyone interested in understanding the basics of the Java SDK
- [Teacher] Okay, welcome back. In this lecture we'll introduce you to the JDK or Java Development Kit. The key objectives of this lecture will be for you to: review and explain the JDK structure, understand how various Java resources that you program can be organized, and be able to compile and run a simple Java class, using the Java c and Java tools from within the JDK. To begin with, the Java SE Development Kit or JDK provides the various tools and API's used to build applications in Java. In previous versions of Java, the JRE was part of the JDK. The development kit contained a JRE subfolder containing a complete JRE folder structure. Starting in Java nine, the folder structures of both the runtime and the development kit are now identical. Only the content of the various folders differs between the two. Another big change is the introduction of the conf or configuration folder. This folder contains all configuration files that may be edited by users or developers to configure the runtime, while property and configuration files only used by the internal implementation are hidden inside other folders. The lib folder, for example, contains all implementation details of Java which should not be modified by developers and users. Since Java nine introduces the module structure, you will no longer find a single rt.jar file. Instead the jmods folder contains a large number of modules, each containing a set of related technologies.
The JDK is organized into various packages, JARs libraries and modules. Java packages are namespaces for classes. Packages are also the basis for the folder structure containing those classes. Java Class Libraries provide a set of publicly accessible resources. Java Archives are standardized packaging formats. They aggregate class files and resources into a single file. Java Modules are a newer standardized packaging format that are more powerful than JAR files. Java nine has introduced the concept of modules. Modules contain additional metadata and are used to provide an additional encapsulation layer, which itself provides better dependency management. When establishing a development environment several environment variables should be declared. The most important ones are the following: Java_home, this needs to point to the installation directory where the JDK has been installed; path, this should be updated with the additional path of Java_home\bin; and classpath, this indicates the location of where class files may reside and is used by the JVM at runtime to find and load the required types for runtime execution. A couple of extra notes. Classpath in module references can be defined at start up time and classes that are packaged into modules are handled differently when it comes to loading them into the JVM. We'll go into this in more detail as the course progresses. When we develop a Java application. we must conform to some basic rules for representing Java source code. Java source code is kept in a file with a file suffix of .java. We can place multiple classes into the same file but only one of those classes can be public. There can also be only one package key word in the file and must be placed at the top of the file.
When the source file is compiled one or more files with the file suffix of .class, will be created. These files contain the java byte code or instructions that will be read by the Java interpreter. For each class defined in the source file there will be a corresponding .class file. The base name of the class file is the name of the Java class. The class or classes can be tested by running the Java class that contains a main method. To make it easier to maintain your class files in the correct location, the compiler has an option which allows you to specify the output directory of the compiled files. Java source files must be placed within files with the extension .Java. Every .Java file has an associated package. The classes defined in the file are members of that package. Each class within a package must have a distinct name. Any Java file that specifies no package is associated with the anonymous package. If more than one class is defined in a .Java file only one class may be public. The public class provides the file name. Other classes in the same file are used internally to the package, and cannot be used outside of it. When compiled, each class is stored in a separate .class file, with the classes name providing the file name. A runnable Java application must contain a class that has a single main method within it. That application is executed by a runtime interpreter, generally the standard Java interpreter that is typically invoked form the command line. A Java application can be graphical or non-graphical in nature. It generally has no security limitations. So it can perform such tasks as running system commands, making and receiving network connections, accessing the file system and/or performing various operations on the Java runtime. Okay, that completes this lecture. Go ahead and close it. And we'll see you shortly in the next one.
About the Author
Jeremy is the DevOps Content Lead at Cloud Academy where he specializes in developing technical training documentation for DevOps.
He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 20+ years. In recent times, Jeremy has been focused on DevOps, Cloud, Security, and Machine Learning.
Jeremy holds professional certifications for both the AWS and GCP cloud platforms.