JavaFX:无法在linux上找到或加载主类 [英] JavaFX: Could not find or load main class only on linux

查看:1194
本文介绍了JavaFX:无法在linux上找到或加载主类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Intellij Idea在Windows中使用Java(FX)开发了一个程序,并且运行得很好,然后我导出了工件(jar),在Windows上运行它没有问题(使用控制台和双击它)。

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).

然后我把它复制到我的Ubuntu VM,但是它说了

I've then copied it to my Ubuntu VM, but there it says

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

这是清单:

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

JAR文件结构如下所示:

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


推荐答案

Ubuntu和Debian一样,有一个单独的OpenJFX包(OpenJDK的im) JavaFX的补充)。为什么会出现这种情况,当JavaFX是JRE不可或缺的一部分时 - 我不知道,但是你的问题应该通过安装OpenJFX软件包来解决:

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  

(或使用任何其他包管理器),或者通过使用Oracle的JRE。

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

这篇关于JavaFX:无法在linux上找到或加载主类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆