Creating a JavaFX App for CoolBeans 2019.6 (Netbeans 11.1 and JavaFx 13)
This is a short note to document a process for creating a build environment in CoolBeans to
- Build a modular project with JavaFx
- Run project inside CoolBeans environment with the Run Project key (or from menu)
- Debug project inside CoolBeans environment with the Debug Project key (or from menu)
- Extract Javadoc documentation from the project with the Run | Generate Javadoc menu
- Build an jlink image that can be run without installing other components (on the same OS as the build OS)
- Create project using the File | New Project menu, choose Java with Maven then Project from Archetype and then find the javafx-archetype-simple (or javafx-archetype-fxml), pick a project name and ensure you use an appropriate GroupId.
- Go to the Project tab on the left, and find the group Project Files under the new project. Open the pom.xml file and replace everything after line 10 (<maven.compiler.target>11</maven.compiler.target>) with everything after line 10 in gist pom file. Hit Save
- Go to File | Project Properties and go to the Run selection and place your fully-qualified main class in the Main Class text box. Hit OK.
- Set this project to be the main project by right-clicking on the project name and choosing Set as Main Project.
- Replace the nbactions.xml file that is now in the Project Files group with the one from the gist nbactions.xml file. Hit Save
- Select Run | Clean & Build. You may have to do this twice to resolve errors.
- Hit Run. Program should run and display a window with a bit of information. Close the window.
- Set a breakpoint on line 19 (
var label =...) in App.java. Choose Debug | Debug Main Project. It should stop at the breakpoint. Hit continue and you should see the program window. Close it. Clear the breakpoint.
- Choose Run | Generate Javadoc. Choose File tab in the upper left and go to target/site/apidocs/ and select index.html and right-click View. You should see an index of the project.
- While still in the files view, visit the folder jlink-image folder. Go to the bin directory, choose the file named after the project, right-click and select Run. The program should run and again show the window.