I have a STIGViewer-2.8.jar file. This works fine in Microsoft Windows 7 or 10, but does not work in Centos-7.6 linux. In linux when doing java STIGViewer-2.8.jar I get

Error.  Could not find or load main class StigViewer-2.8.jar

I have jdk-8u191-linux-x64.rpm installed, and this is Centos Server with GUI so I am in runlevel 5 with full graphics, everything else is working... Libreoffice, freecad, unameit. Is there some trick I need to do to get jar files to run in linux? Or is it a java thing and a problem with the jar file being Windows only?

  • java <classname> or java -jar <filename>. Commented Mar 19, 2019 at 15:03
  • 1
    using java -jar StigViewer-2.8.jar produces the same error: could not find or load main class.
    – ron
    Commented Mar 19, 2019 at 15:13
  • I would also like to know why it works in Windows I can double click on a .jar file and it works, but in linux it does not; when double-clicking on .jar file from the windows explorer thing in linux I cannot use the folder/explorer thing it doesn't run via java instead it opens it like a container file.
    – ron
    Commented Mar 19, 2019 at 15:17
  • @ron Can you are confirm using Oracles and not the openjdk .RPM?
    – 0xSheepdog
    Commented Mar 19, 2019 at 15:18
  • I downloaded jdk-8u191-linux-x64.rpm from oracle and did a yum install on it. Then this jar file did not work. So using software gui i installed openjk 1.6, 1.7, 1.11; 1.8 already installed.
    – ron
    Commented Mar 19, 2019 at 15:25

2 Answers 2


Having EPEL respository active, using software gui I removed all the OpenJava or OpenJDK stuff; did a search on java and unchecked using good judgement. Some things like json-glib or python-javapackages or tzdata-java I left alone.

then i did a yum install jdk-8u191-linux-x64.rpm which is from oracle.

That shows up in software gui as jdk1.8-2000: with no Open wording, and all the OpenJava or OpenJDK stuff is not installed.

After that it works only using java -jar StigViewer.jar

If I do just java StigViewer.jar I still get the error, and if I double click on the .jar file from the windows explorer it opens the file like it was a container.

When installing centos 7.6; I chose Server with GUI and I think there was a choice for java stuff but if there was I know I didn't choose, so it seems centos installs openjava automatically to some extent.


oracle jdk-8u201-linux-x64.rpm results in /usr/bin/java link to /etc/alternatives/java which then points to /usr/java/jdk1.8.0_201-amd64/jre/bin/java

it is THIS oracle java that works with this stigviewer.jar file only by java -jar stigviewer.jar

Other software like Octave and plplot rely on OpenJDK Headless Runtime Environment 8 which is java-1.8.0-openjdk-headless-1: and that results in the /usr/bin/java still linking to /etc/alternatives/java and that links to /usr/lib/jvm/java-1.8.0-openjdk- which is no workie for this stigviewer.jar file.

So I can remember to manually run Oracle's /usr/java/jdk1.8.0_201-amd64/jre/bin/java when I need to. It seems once OpenJDK is at all installed, the oracle rpm will not overwrite the links.

  • 3
    Your issues are also compounded by the $PATH and which java executable was being called. I downloaded and installed the jdk1.8-1.8.0_201 .RPM from Oracle; then I changed the /etc/alternatives link to point to /usr/java/latest/bin/java; finally, I executed /usr/java/latest/bin/java -jar ./path-to/STIGViewer-2.8.jar and successfully opened the app. Glad you worked it out!
    – 0xSheepdog
    Commented Mar 19, 2019 at 15:44
  • 4
    If you are using a JAR file you must use the -jar parameter before the name of the JAR file. That is in the man page for java and also mentioned in java -help command. Commented Mar 19, 2019 at 15:56

I would like add that Red Hat has documented this issue for RHEL 7: DISA STIG viewer does not run with OpenJDK. This link needs a Red Hat login to work, so I will reproduce the key information here.

Environment: Red Hat Entreprise Linux 7 (RHEL7), OpenJDK 1.8

Issue: DISA STIGViewer does not run with OpenJDK:

$ java -jar ./STIGViewer-2.7.1.jar
Error: Could not find or load main class stigviewer.STIGViewer

Resolution: Use Oracle's JRE instead of OpenJDK for that application. Oracle's JRE or JDK has to be downloaded from Oracle's website.

Root Cause: OpenJDK cannot be used because the DISA STIGViewer application uses JavaFX internally which is not provided by OpenJDK.

Note that the default Java 8 binaries on RHEL 7/CentOS 7 come from the java-1.8.0-openjdk package.

The STIG Viewer 2.x User Guide also mentions this under Section 1.1 Notes:

This tool is produced in Java, and delivered as a single JAR file. It requires the Java Runtime Environment (JRE) be installed on the user’s machine to run (i.e., to run the STIG Viewer tool, Oracle Java is required). This allows the program to be run on any operating system for which the JRE is produced. This also limits the program to running at the permission level of the currently logged in user.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .