Book Image

Java Projects - Second Edition

By : Peter Verhas
Book Image

Java Projects - Second Edition

By: Peter Verhas

Overview of this book

Java is one of the most commonly used software languages by programmers and developers. In this book, you’ll learn the new features of Java 11 quickly and experience a simple and powerful approach to software development. You’ll see how to use the Java runtime tools, understand the Java environment, and create a simple namesorting Java application. Further on, you'll learn about advanced technologies that Java delivers, such as web programming and parallel computing, and will develop a mastermind game. Moving on, we provide more simple examples, to build a foundation before diving into some complex data structure problems that will solidify your Java 11 skills. With a special focus on the features of new projects: Project Valhalla, Project Panama, Project Amber, and Project Loom, this book will help you get employed as a top-notch Java developer. By the end of the book, you’ll have a firm foundation to continue your journey toward becoming a professional Java developer.
Table of Contents (12 chapters)

Getting started with project structure and build tools

When a project is more complex than a single class, and it usually is, then it is wise to define a project structure. We will have to decide where we store the source files, where the resource files (the ones that contain some resource for the program but are not Java source) are, where the .class files should be written by the compiler, and so on. Generally, the structure is mainly the directory setup and the configuration of the tools that perform the build.

The compilation of complex programs cannot be feasibly done using the command line issuing javac commands. If we have 100 Java source files, the compilation will require that many javac commands to be issued. It can be shortened using wildcards, such as javac *.java, or we can write a simple bash script or a BAT command file which does that. First, it will be just 100...