Getting Started - conor-mcmullan/Graph-Algorithm-Animation-JavaFX-App GitHub Wiki

Alternative to dependencies downloading

  • Fully aware that people like a fast solution and don't often follow instructions I included the downloaded libs within the project itself.
  • Obviously increasing size but insuring you would have at least a pre solved solution should future methods of obtaining the dependencies no longer work.
  • I would check out the project and point the PATHs to these internal files if you are not downloading the libs and altering PATHs for future global use.

Alternatives

Java

  • Sadly I opted to store Java on my PATH so you will download this separately as explained below.

JavaFX

Redis (Jedis)

  • Downloading the lite .exe files or the lib can be found in the project itself, you will not need to find the .exe downloads, I have done so to stop any problems of finding malicious files on the internet.
  • Download the Redis/Jedis lib/Jar

Notes

Notes

  • The project was developed using the Java JDK Version 13.0.1
  • Since Java Version 8, JavaFX and Java Parted ways from a singular dependency.
  • To set up your IDE or system to run the project you must install/download an appropriate level of the Java JDK (minimum 11) (expected 13) and the JavaFX Libary from official sources below.

Redis (Jedis)

Redis

  • A small KEY VALUE store that uses cache memory.
  • Redis Server launches before the Application runs with host:localhost
  • In the project Redis is used to record clicked on nodes and temporarily store requested changes to the Graph.
  • Download the Redis/Jedis lib/Jar

Java

Java

  • JDK is the Java Development Kit
  • Java is installed and runs on over 3 Billion devices and is one of the main reasons why the project was developed using this Programming Language
  • You don't need to be a full-on Programmer, Software Engineering or a Hacker to utilize Java, almost certainly there is a version of Java installed on your system already, simply the project requires a specific version/level
  • Get Java JDK: Method 1
  • Get Java JDK: Method 2

JavaFX

Java

  • JavaFX was turned into an external dependency when Java 8 Rolled out and must be included separately.
  • JavaFX is a module/lib that contains Classes used to develop and visualize Objects to the user using fxml.

FXML


Intellij IDEA IDE Setup

IntelliJ IDEA

IDE - Java JVM Args Setup

  • JVM - Java Virtual Machine
  • Rule 1 - Don't be afraid of command-line arguments
  • During the run of the project from and IDE the command line arguments are short and sweet and you will only need to set them once!

After downloading the Java & JavaFX dependencies

  • Below are instructions on how to set up your IDE to run the App as an IntelliJ Project.
1. Navigate to File > Project Structure
  • Opening project structure
2. Underneath the tab Project Settings there is an option Project
  • Viewing project settings
  • Now that you have downloaded and installed the Java JDK 13
  • Set the selected Project SDK to the JDK you have just set up
  • Also the compiler output directory can be set, this is where your project builds and Built Artifacts (JAR) can be found.
3. Adding Jedis & JavaFX dependencies to the Project libraries
  • Clicking the + symbol will open a File IO System Window that you will be able to navigate and add the libs to the project from.
4. Added libs
  • When you have added the libs to the project they will appear as displayed in this image, Click Ok and Close the Project Structure Window.
5. Edit Configurations
  • Towards the top right of your IntelliJ IDEA Window you should see the below image.
  • Click The Down Arrow.
  • Click Edit Configurations.
6. Set JRE
7. Set JavaFX ENV PATH Variable
  • The best option before execution is to take note of where you have stored your JavaFX lib.
  • As mentioned above the lib is stored internally as a fallback as to where you can direct the PATH.
  • However, set and environment variable by clicking the + button and entering the Key and Value.
  • This environment variable is not dependant on the operating system, just set it to where the lib folder can be found.
  • Click OK.
8. Set VM Options
  • JRE & JavaFX libs have been set.
  • When you click run the following arguments are passed to the JVM as command-line arguments.
  • The following arguments should not be altered.
  • The part containing ${PATH_TO_FX} is replaced with the ENV Variable value you set in step 7 at run time.
  • Click the expansion button.
  • Copy & Paste in the following to match the picture below.
--module-path ${PATH_TO_FX}    
--add-modules javafx.controls,JavaFX.fxml,JavaFX.graphics    
--add-reads javafx.graphics=ALL-UNNAMED    
--add-opens javafx.graphics/com.sun.javafx.perf=ALL-UNNAMED
  • When your VM options match Click OK.

App Only / JAR Only

What is a JAR?

  • JAR -Java ARchive
  • A package file format typically used to aggregate many Java class files and associated metadata and resources (text, images, etc.) into one file for distribution.

Download the JAR


Run Script

  • Running the App as a JAR has been made as simple as a One-Time Setup Script.

Download the Script


How to run the JAR

Required Dependencies (Downloads)

  • JavaFX 13.0.1 >
  • Java JDK 13.0.0 >
  • Jedis Lib
  • JAR
  • Start Script

Step 1: Edit the file

  • Open your downloaded deployScript
  • Following the comments instructions to set all the required environment variables to the PATHs of your downloaded libs and the JAR

Windows

Windows OS

Way 1 (Automated):

Create a Shortcut with elevated privilledges

  • Create a Shortcut to the original deployScript.bat
  • Right-Click on the shortcut
  • Properties > Shortcut > Advanced..
  • Enable Run as Administrator

Way 2 (Manual):

Command Prompt:

  • Press: Windows Key
  • Type: cmd
  • Right, Click On "Command Prompt".
  • Choose "Run as administrator".

Navigation:

  • Move to the location of the "deployScript.bat" file.

Launch:

  • Command to type: deployScript.bat
  • Press enter to execute.

Linux & MacOs

Linux MacOs

Terminal:

  • Open a new terminal window

Navigation:

  • Move to the location of the "deployScript.sh" file.

Launch:

  • Command to type: ./deployScript.sh or sh deployScript.sh
  • Press enter to execute.

Common Problems

Command Permissions

MacOS & Linux

  • You may wish to run as root if you face permission errors, prefixing commands using sudo [command], alternatively you change to root level using sudo su, using root level may prompt you for your admin/user password.

Windows Permissions

  • Setting Environment variables using setx -m [key] [value], the -m or /M will possibly cause problems as the script requires a higher level of permissions, although the script may be ran using Administrator it will not work, you must launch the CMD: Command Prompt or PS: Powershell using Run as Admin to elevate permissions.