JDK and JRE Setup

JRE not needed for Version > 10

Download Java LTS (Java 8, Java 11, …)

Intellij (>2019.1) comes with bundled JDK which includes JavaFX

Java Path Variable Setup

Windows

Go to “Advanced System Settings”:

Start Menu

Go to “Environment Variable

Envirnmement Variable

Add New System Variable named “JAVA_HOME” where you have installed your JDK

Java Home

Edit Path in System Variable and add the location where “javac.exe” is located

Path Variable

Linux

Check if Java is installed

javac --version

Else install from debian Packages or APT

JAVA_HOME Setup using

export JAVA_HOME= /usr/java/jdk1.7.0_05/

PATH Setup using

export PATH=${PATH}:${JAVA_HOME}/bin

Select which Java Version to use

sudo update-alternatives --config java

IntelliJ Setup

IntelliJ Idea Community Edition: Just Download and Install.

IntelliJ Idea Ultimate Edition: for free,

  1. Open JetBrains Account

  2. Apply Now for students, Use your BUET email to verify

alt_text

  1. Checkout Licence Page

  2. Download IntelliJ Ultimate

  3. Install and Run. You’ll be asked for Licence or 14 days trial. Log in with your account and Use IntelliJ Idea Ultimate for free

You have to apply for renewal of your licence every year, you will get an E-mail 14 days before expiration

IntelliJ with Bundled JDK

Configure JDK with IntelliJ:

Go to Structure for New Projects

Project Structure

Select New JDK if there isn’t one

Intellij (>2019.1) comes with bundled JDK which includes JavaFX

JDK Select

And Select the directory where you installed JDK.

You’re ready to go…

Java Exporting Executable Files

Go to: File > Project Structure > Artifacts

Artifacts

Add + Jar > From Modules with Dependencies… > Select Main Class

Build Jar

Go to Build > Build Artifacts, It will create a new Jar File

To run .jar Files:

java -jar my_jar.jar

To run .jar with JAVA_FX Dependencies:

java --module-path PATH_TO_JAVAFX/lib --add-modules=javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web --add-opens javafx.base/com.sun.javafx.runtime=ALL-UNNAMED --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 messenger-client-gui.jar