Intellij Project可执行文件没有做任何事情 [英] Intellij Project executable not doing anything

查看:219
本文介绍了Intellij Project可执行文件没有做任何事情的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经多次遍历这些步骤,为我的javaFX intellij项目创建了一个可执行的.jar文件,但每次都失败了。我成功构建了.jar文件,但是当我点击它时没有任何反应。我去项目结构,创建工件,添加主类,然后构建该工件。依然没有。我已经包含了该文件的图片,但我不确定甚至会显示会导致此错误的内容。有什么想法吗?

I have walked through the steps multiple times for creating an executable .jar file for my javaFX intellij project, but it has failed every time. I successfully build the .jar file, but when I click it nothing happens. I go to project structure, create artifact, add the main class, then build that artifact. Still nothing. I have included the picture of the file, but am unsure as to what to even show that would be causing this error. Any thoughts?

[![在此处输入图像说明] [3]] [3]

[![enter image description here][3]][3]

运行<$ c $时出现的错误c> java -jar TestingProto.jar 是:
线程main中的异常java.lang.UnsupportedClassVersionError:JVMCFRE003错误的主要版本; class = sample / Maine,offset = 6

我假设我的班级版本有问题,但我不知道使用任何第三方罐等。

i'm assuming there is an issue with versioning in my main class, but I don't use any third party jars, etc.

推荐答案

目前,您无法看到代码有什么问题。文件夹结构看起来像一团糟。如果jar没有运行,那么它没有入口点,这是Main类中的 main()方法。如果您有 main()方法,那么请查看导入上方的包声明 - 它们应该与 src下面的文件夹结构一致/ main / java (在您的情况下,它是包样本; )。我建议你在IDE中创建一个新的JavaFX Maven项目,然后在与Main类相同的文件夹级别创建所有类,包括 Transform 类(它不应该像现在这样在结构之外)。 Maven是一个很棒的工具,因为你安装它并设置你的环境变量,你需要在你的新maven项目的根文件夹中打开一个终端/命令行并输入 mvn package 你会发现你的工作 .jar (或 .war ,如果在 pom.xml )在目标文件夹中(将出现)。但请确保使用maven标准文件夹结构,并且每个类中的包名称与此类实际驻留的文件夹结构相同,紧跟在 src / main / java / 路径。

For the moment, it is impossible to see what is wrong with your code. The folder structure looks like a mess. If a jar doesn't run then it has no entry point, which is the main() method in the Main class. If you have the main() method, then take a look at your package declarations above imports - they should be consistent with your folder structure below the src/main/java (in your case it is package sample;). I would recommend you to create a new JavaFX Maven project in your IDE, then in the same folder level as a Main class, create all your classes, including the Transform class (it shouldn't be outside the structure as it is now). Maven is a great tool and since you install it and set your environment variables, you will need to open a terminal/command line in the root folder of your new maven project and type mvn package and you will find your working .jar (or .war, if stated so in pom.xml) in a target folder (it will appear). But be sure you use the maven standard folder structure and that the package name in every class is the same as the folder structure, where this class actually resides, right after the src/main/java/ path.

这篇关于Intellij Project可执行文件没有做任何事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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