使用Eclipse将JavaFX Project导出到runnable [英] Export JavaFX Project to a runnable using Eclipse
问题描述
我正在使用 Eclipse
并在javaFX中制作一个简单的游戏。我有图像,需要将它们和javafx打包成一个可运行的文件。我没有使用任何与javafx相关的CSS,只是基本的窗口和阶段和东西。
谢谢!
I'm using Eclipse
and making a simple game in javaFX. I have images and need to package them and the javafx into a runnable file. I am not using any of the css stuff related to javafx, just the basic windows and stages and stuff.
Thanks!
我试图将其导出但不起作用。
I have tried to just export it however it did not work.
推荐答案
-
-
第1部分
Part 1
JavaFX Eclipse项目如下:
-
因此,您可以确定每个图书馆和资源都在
So with the above you are sure that every library and resource will be in the
1)进入最后的Jar
1)Into the final Jar
或
2)你将有一个final Jar和一个单独的文件夹,其中包含您正在使用的所有外部库。
2)You will have a final Jar and a separate folder which contains all the external libraries you are using.
或
3)(2)+其他资源的外部文件夹
3) (2)+External Folder for other resources
导出项目:
Exporting the Project:
1)右键单击项目
2)导出 - > Java-> Runnable Jar文件...
2)Export->Java->Runnable Jar File...
< a href =https://i.stack.imgur.com/5UdET.png =nofollow noreferrer>
3)选择您的主要课程
3)Choose your main class
4)开库处理它是您的选择(最好选择 3rd 选项,因为它可以防止包含相同类并且不违反某些库许可的库发生冲突)
4)On Library Handling it is your choice(better choose the 3rd option cause it prevents conflicts on libraries which containing same classes and doesn't violate some libraries licence)
5)导出
最后
Finally
另请参阅此链接在commen中提供ts。
Also have a look at this link which was provided in the comments.
第2部分)
完成上述操作后,您可以使用 Launch4J 将您的jar文件打包成.exe文件(适用于Windows)
After you have done the above you can use Launch4J to package your jar file into an .exe file(for Windows)
第3部分
您还可以导出JavaFX Project可以在Windows,Mac和Linux中使用。
You can also export your JavaFX Project in a way that it can be used in windows,Mac and Linux.
为此你可以使用文件 build.fxbuild 和建立项目(在互联网上搜索大主题)
For that you can use the file build.fxbuild and build the project(big topic search for it on internet)
这篇关于使用Eclipse将JavaFX Project导出到runnable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!