JavaFX: Could not find or load main class only on linux

匿名 (未验证) 提交于 2019-12-03 01:25:01

问题:

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

I've then 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 JAR file structure looks like this:

test.jar --- META-INF --- --- MANIFEST.MF --- org --- --- json --- --- --- // json library --- sample --- --- Contacts.class --- --- Controller.class --- --- Main.class --- --- sample.fxml 

回答1:

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

# aptitude install openjfx   

(or using any other package manager), or by using Oracle's JRE.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!