JavaFX: could not find or load the main class only on Linux

I developed a program on Windows with Java (FX) using Intellij Idea, and it worked fine, I then exported the artifact (jar), and there was no problem running it on Windows (both with the console and double-clicking it) .

Then I copied it to my Ubuntu VM, but there it says

Error: Could not find or load main class sample.Main 

This is the manifest:

 Manifest-Version: 1.0 Main-Class: sample.Main 

The structure of the JAR file is as follows:

 test.jar --- META-INF --- --- MANIFEST.MF --- org --- --- json --- --- --- // json library --- sample --- --- Contacts.class --- --- Controller.class --- --- Main.class --- --- sample.fxml 
+6
source share
1 answer

Ubuntu, like Debian, has a separate package for OpenJFX (implementation of OpenJDK JavaFX). Why is this so when JavaFX is an integral part of the JRE - I don’t know, but your problem should be solved by installing the OpenJFX package:

 # aptitude install openjfx 

(or using any other package manager) or using Oracle JRE.

+3
source

All Articles