How to use India income tax Java utilities on Linux Mint 19

To run the Indian income tax Java utilities on Linux Mint 20 or Fedora 32 or Ubuntu 20.04 LTS, refer to this link

Upon download and execution of the income tax India utilities for the ITRs for Java, the following error is display when the utility is run using Java 11 on Linux.

“Error: JavaFX runtime components are missing, and are required to run this application”

This is error basically indicates that to run the income tax java files, JavaFX is to be installed. It is pertinent to note that since Java 9, Oracle does not bundle Java FX with the Java runtime anymore. Therefore, we are constrained to download and use Oracle Java 8 with the utilities. That essentially means that we have an older insecure version of Java with bundled Java FX to run the income tax Java utilities.

To the rescue comes OpenJDK. OpenJDK is bundled with every Linux distribution. The Income Tax Java utilities work with OpenJDK 11 as installed on Ubuntu 18.04 LTS or above, Linux Mint, Fedora and other distributions, but they display the JavaFX runtime components as missing, as those are not bundled with OpenJDK 11.

To fix the above error, open a terminal window and enter the following commands:

$ sudo apt-get install openjfx=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2 <enter>

This installs the OpenJFX. Let’s try running the Java ITR2 utlity and see what happens.

$ java -jar ITR-2_AY201920_PR5.2.jar <enter>

This again displays the JavaFX error. To finally set this right, enter the following command which will allow the selection of the Java 8 runtime so it can be used with JavaFX:

$ sudo update-alternatives --config java <enter>

The following result is displayed and select the Java 8 runtime as below.
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status

* 0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press  to keep the current choice[*], or type selection number: 2

Enter 2 to use Java 8 as it is the only one that runs the income tax utility.

Now run the ITR2 Java utility again
$ java -jar ITR-2_AY201920_PR5.2.jar <enter>

To revert back to OpenJDK 11, select 0 after entering the following command.

$ sudo update-alternatives --config java <enter>

As long as the ITR utilities in Java are built with JavaFX, the above method will work.