OpenJDK cannot find main class in jar while OracleJDK can

jar, java, java-8, javafx

Solution

Ok I found the answer. The problem was that I had a JavaFX application and the OpenJDK runtime enviroment that was installed doesn't support that, which I don't understand, since JavaFX is part of the standard in Java 8.

OpenJDK lib/ext folder:

cldrdata.jar       nashorn.jar
dnsns.jar          sunec.jar
icedtea-sound.jar  sunjce_provider.jar
jaccess.jar        sunpkcs11.jar
localedata.jar     zipfs.jar
meta-index

as you can see if you are familiar with it `jfxrt.jar` is missing. Which explains why it can't load the Main-Class, since it inherited from `javafx.application.Application`.

Problem

I have the problem, that I cannot run any jars with OpenJDK at all, where as with the normal OracleJDK it is no problem. ``` OpenJDK # java -version openjdk version "1.8.0_101" OpenJDK Runtime Environment (IcedTea 3.1.0) (suse-14.3-x86_64) OpenJDK 64-Bit Server VM (build 25.101-b13, mixed mode) ``` when I run a jar with this JDK it can never find the main class even tough it is in the manifest. ``` OracleJDK # java -version java version "1.8.0_102" Java(TM) SE Runtime Environment (build 1.8.0_102-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode) ``` when I launch a jar with this JDK it is no problem. Do I need to configure something in OpenJDK so it can find the main class from the manifest or what is it that OpenJDK fails to do so? Edit: Source file structure: ``` -- ui ---- Main.java ``` Gradle build script: ``` group 'some.group' version '0.1' apply plugin: 'java' apply plugin: 'application' mainClassName = "ui.Main" sourceCompatibility = 1.8 repositories { mavenCentral() } dependencies { compile group: 'org.zeromq', name: 'jeromq', version: '0.3.5' compile group: 'org.controlsfx', name: 'controlsfx', version: '8.40.12' testCompile group: 'junit', name: 'junit', version: '4.11' } jar { manifest { attributes 'Implementation-Title': 'PlaceholderTitle', 'Implementation-Version': version, 'Class-Path': configurations.compile.collect { it.getName() }.join(' '), 'Main-Class': mainClassName } } ``` building with `installDist` Manifest: ``` Manifest-Version: 1.0 Implementation-Title: PlaceholderTitle Implementation-Version: 0.1 Class-Path: jeromq-0.3.5.jar controlsfx-8.40.12.jar Main-Class: ui.Main //new line here ```

Original source