[英]How do i define the right class path to my executable jar file?
I am having problem with creating an executable JAR file where i can double click an icon and make my program start.我在创建可执行 JAR 文件时遇到问题,我可以在其中双击图标并启动我的程序。 I've made a fun little app for my friend for him to try this Xmas, but i've spent way too many hours trying to make this work.
我为我的朋友制作了一个有趣的小应用程序,让他尝试这个圣诞节,但我花了太多时间来尝试让它发挥作用。
When i try to execute the jar file, i get a ClassNotFoundException and i cannot for the life of me figure it out.当我尝试执行 jar 文件时,我得到一个 ClassNotFoundException 并且我一生都无法弄清楚。 I am using Intellij and believe the fault is under file>projet structure>artifacts>JavaFX and under application class.
我正在使用 Intellij 并相信故障出在文件>项目结构>工件>JavaFX和应用程序类下。 What is supposed to be there?
那里应该有什么? i tried class path to the main class
我尝试了主类的类路径
If you are using maven or gradle to build your application, the simplest thing you can do to make a self sufficient, runnable jar is, to create a fatjar (or uber jar ).如果您正在使用 maven 或 gradle 来构建您的应用程序,那么制作一个自给自足、可运行的 jar 的最简单的方法就是创建一个fatjar (或uber jar )。 A fatjar is nothing but a jar containing your classes along with the dependencies.
fatjar 只不过是一个包含类和依赖项的 jar。
Refer answer below for maven based project : How can I create an executable JAR with dependencies using Maven?请参阅以下基于 Maven 的项目的答案: 如何使用 Maven 创建具有依赖项的可执行 JAR?
Or for gradle based project : How do I create an executable fat jar with Gradle with implementation dependencies或者对于基于 gradle 的项目: How do I create an executable fat jar with Gradle with implementation dependencies
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.