Implementation of Java Sockets to show RPC communication between a server and clients.
- Java OpenJDK >= 14.x Installation Guide
- JavaFX 14.x Installation Guide
- Create a
PATH_TO_FX
environment variable that points to the JavaFX lib folder
Linux/Mac:
export PATH_TO_FX=path/to/javafx-sdk-14/lib
Windows:
Ensure you are the administrator of your system and follow the steps listed here, depending on your version of Windows.
set a new System Variable PATH_TO_FX with the value 'path\to\javafx-sdk-14\lib'
In the out/artifacts
there are executable JAR files and shell scripts for the server and client.
Click to run or execute in the terminal.
Here are the commands if you want to run them directly.
Client (Linux/Mac):
java --module-path $PATH_TO_FX --add-modules javafx.controls,javafx.fxml --add-opens javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED --add-opens javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.binding=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.event=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED -jar Client.jar
Client (Windows):
java --module-path %PATH_TO_FX% --add-modules javafx.controls,javafx.fxml --add-opens javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED --add-opens javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.binding=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.event=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED -jar Client.jar
Server (Linux/Mac):
java --module-path $PATH_TO_FX --add-modules javafx.controls,javafx.fxml --add-opens javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED --add-opens javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.binding=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.event=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED -jar Server.jar
Server (Windows):
java --module-path %PATH_TO_FX% --add-modules javafx.controls,javafx.fxml --add-opens javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED --add-opens javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.binding=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.event=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED -jar Server.jar
Go to Run | Edit Configurations
for both the ClientApplication.java
and ServerApplication.java
. Under
VM options add the following:
--module-path $PATH_TO_FX --add-modules javafx.controls,javafx.fxml --add-opens javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED --add-opens javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.binding=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.event=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED
Note: Replace $PATH_TO_FX with the full path to the javafx-sdk
lib
folder