CPSC 343 | Database Theory and Practice | Fall 2024 |
If you want to work on your own computer, you may need to install some software. (If you are using the HWS Linux environment, whether in the lab or via the VDI, you can skip this step.)
If you don't already have Java and JavaFX installed, Java 17 is recommended. (If you already have a different version of Java, get the corresponding version of JavaFX.)
Install Java 17 (JDK, not JRE) and the corresponding JavaFX libraries. See "Getting a JDK" and "JavaFX on the Command Line" in Introduction to Programming Using Java for instructions. (For JavaFX, you only need to read the first several paragraphs in the section — you only need to download JavaFX and know where you put it on your computer. On the Gluon site, look for version 17.0.13 in the JavaFX version dropdown in the "Downloads" section, then choose the appropriate options for your OS and architecture. The type should be "SDK". The rest of the section in the text deals with using JavaFX when you run Java programs on the commandline, and you don't need that.)
If you don't already have Eclipse installed, Eclipse version 2024-06 is recommended.
Install Eclipse 2024-06. See "Eclipse IDE" in Introduction to Programming Using Java for instructions. (direct download link)
This must be done for each Eclipse workspace you use. If you are setting up Eclipse on your own computer, substitute the path for your JavaFX installation for /opt/jfx17/lib below. You'll also need to copy the files from /classes/cs343/eclipse to your own computer for the other configuration.
Set up Eclipse so that all projects within the current workspace can use the JavaFX libraries:
From the "Window" menu, choose "Preferences". On the left side, expand "Java".
Configure the Java 17 JRE with the VM options needed for JavaFX:
Choose the main "Installed JREs" entry under "Java".
Select the openjdk 17 JRE in the list and click "Edit...". (Ask if there's more than one choice and/or you aren't sure which to pick.)
Fill in the "Default VM Arguments" box with
--module-path=/opt/jfx17/lib --add-modules=ALL-MODULE-PATH
(Make sure you include the -- at the very beginning!)
Click "Add External JARs...", navigate to /opt/jfx17/lib, and select all of the files there.
Click "Finish".
Configure the default Java 17 environment to be the one you just set up for JavaFX:
Expand the "Installed JREs" item under "Java", then click "Execution Environments".
Click "JavaSE-17" in the list of execution environments to select it, then click on the openjdk JRE in the list of compatible JREs to toggle the checkbox on. (Ask if there's more than one choice and/or you aren't sure which to pick.)
Finally, click "Apply and Close" at the bottom of the Preferences window to apply the new settings and close the window.
Other workspace configuration that you may want to do: (not specific to JavaFX)
From the "Window" menu, choose "Preferences". On the left side, expand "Java".
Specify how code should be formatted:
Expand the "Code Style" item under "Java", then click "Formatter".
On the right side of the window, click "Import..." and then navigate your way to /classes/cs343/eclipse (start with "File System" and then double-click on each directory in turn).
Highlight cs329-formatter.xml and click "OK".
Make sure that cs329 is shown as the "Active profile".
Specify options for code generation:
Expand the "Code Style" item under "Java", then click "Code Templates".
On the right side of the window, click "Import..." and then again navigate your way to /classes/cs343/eclipse.
Highlight cs329-codetemplates.xml and click "OK".
At the bottom of the right side of the window, click the "Automatically add comments for new methods, types, modules, packages and files" box. (It should be checked.)
Tell Eclipse about the convention of naming instance variables ending with _:
Choose the main "Code Style" entry under "Java".
On the right side of the window, click on "Fields" in the box under "Conventions for variable names:" to highlight it, then click the "Edit..." button. In the box that pops up, enter _ (an underscore) in the "Suffix list" box and click OK.
Tell Eclipse to enforce Java 17 syntax rules:
Choose the main "Compiler" entry under "Java".
Set the compiler compliance level to 17.
Tell Eclipse to store compiled classes separately from source files:
Choose the main "Build Path" entry under "Java".
Make sure that the "Folders" option is selected under "Source and output folder", and that the source folder name is src and the output folder name is bin.
Finally, click "Apply and Close" at the bottom of the Preferences window to apply the new settings and close the window.