Java SE
Java SE
Java platform, Standard Edition (Java SE) enables you to develop secure, portable, high-performance applications for the widest range of computing platforms possible. By making applications available across heterogeneous environments, businesses can boost end-user productivity, communication, and collaboration—and dramatically reduce the cost of ownership of both enterprise and consumer applications.
Java SE applications run on the computer desktop, as opposed to the browser or a mobile device. These applications are sometimes referred to as “on-premise” applications. A complete end-to-end description of creating a Java SE application is provided in Chapter 2 of this book. The starting point for all these kinds of applications is to go to File ➤ New Project (Ctrl+Shift+N), which opens the New Project wizard. Choose the Java category, as shown in Figure 4-5 .
Figure 4-5. Getting started with Java SE projects As you can see in Figure 4-4 , different entry points are provided for getting started creating and working
with Java SE applications in the IDE. Normally, you will use the Java Application project template to start your work in the IDE. Especially when you are first learning the Java language, this is the ideal entry point for the kind of work you are likely doing.
Three more specialized project templates are provided. The Java Class Library project template will create a new Java application without a main class. The idea is that you will use the project structure provided by this template for creating Java libraries, that is, bundles of Java code that provide a piece of generic functionality for a Java application. Use the Java Project with Existing Sources project template when you want to create a NetBeans project out of a set of folders on disk that contain Java source files, without there being a build.xml file. Ant drives these applications and the IDE will set up the Ant build script for you. Oftentimes, such an Ant build script already exists, in which case you would use the Java free-form project template, which lets you import an Ant build.xml file together with your Java sources. If you are using Maven instead of Ant as your build system, use the Maven category instead of the Java category in the New Project wizard. If your Maven project already exists on disk, simply open it via File ➤ Open Project, because the IDE automatically knows how to interpret your POM file. To create a new Maven project for Java SE applications, choose Maven ➤ Java Application or Maven ➤ JavaFX Application in the New Project wizard.
Once the application has been set up, you will want to create new files, typically new Java source files, in it. To do so, go to File ➤ New File (Ctrl+N), shown in Figure 4-6 . In particular, the Java, JavaFX, Swing GUI Forms, JavaBeans Objects, and AWT GUI Forms categories relate directly to Java SE development.
Figure 4-6. Getting started with files in Java projects Depending on the kind of file you create, the IDE provides a variety of supporting features. In Chapter 3
of this book, the Java Editor is described in detail. In addition, the IDE provides the Matisse GUI Builder for the layout and design of Java Swing components and integration with the JavaFX Scene Builder for the layout and design of JavaFX components. Details on these GUI designers are found on the Java GUI Applications Learning Trail, on NetBeans.org, at the following URL: https://netbeans.org/kb/trails/matisse.html .
Be aware that you can configure each project you work with in the Project Properties window. Right- click a project and choose Properties. The Project Properties window, shown in Figure 4-7 , opens. A range of configurations can be defined for each project you work on, from the JAR files on its classpath to compilation settings and runtime commands. For example, when you are working with Maven-based applications, you can map commands in your POM file to project commands so that when you press F6, which runs your project, you can execute goals that you have defined in your POM. Quite a range of features in the IDE can be configured, all in a unified location that the IDE makes available in the Project Properties window.
Figure 4-7. Properties of Maven-based Java EE projects
As you become more familiar with the IDE, you will probably increasingly want to use keyboard shortcuts rather than menu items and toolbar buttons. Hover with your mouse over the toolbar buttons to see their related keyboard shortcuts, such as F6 for Run and F11 for Build. In the Keymap section of the Options window, you can tweak and fine-tune all keyboard shortcuts that relate to working with your projects. For a list of keyboard shortcuts, go to Help | Keyboard Shortcuts Card.