简体   繁体   English

使用Eclipse将JavaFX Project导出到runnable

[英]Export JavaFX Project to a runnable using Eclipse

I'm using Eclipse and making a simple game in javaFX. 我正在使用Eclipse并在javaFX中制作一个简单的游戏。 I have images and need to package them and the javafx into a runnable file. 我有图像,需要将它们和javafx打包成一个可运行的文件。 I am not using any of the css stuff related to javafx, just the basic windows and stages and stuff. 我没有使用任何与javafx相关的CSS,只是基本的窗口和阶段和东西。 Thanks! 谢谢!

I have tried to just export it however it did not work. 我试图只是导出它,但它没有用。

  • Part 1 第1部分

    A JavaFX Eclipse Project is like: JavaFX Eclipse项目如下:

在此输入图像描述

So with the above you are sure that every library and resource will be in the 因此,通过上述内容,您可以确保每个库和资源都在

1)Into the final Jar 1)进入最后的Jar

or 要么

2)You will have a final Jar and a separate folder which contains all the external libraries you are using. 2)您将拥有一个最终的Jar和一个单独的文件夹,其中包含您正在使用的所有外部库。

or 要么

3) (2)+External Folder for other resources 3)(2)+其他资源的外部文件夹

Exporting the Project: 出口项目:

1)Right Click on the Project 1)右键单击项目

2)Export->Java->Runnable Jar File... 2)Export-> Java-> Runnable Jar文件......

在此输入图像描述

3)Choose your main class 3)选择你的主要课程

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) 4)关于库处理它是你的选择(最好选择第3个选项,因为它可以防止包含相同类的库的冲突,并且不违反某些库许可)

5)Export It 5)出口它

Finally 最后

Also have a look at this link which was provided in the comments. 另请查看评论中提供的此链接

  • Part 2) 第2部分)

After you have done the above you can use Launch4J to package your jar file into an .exe file(for Windows) 完成上述操作后,您可以使用Launch4J将jar文件打包成.exe文件(对于Windows)

  • Part 3) 第3部分)

    You can also export your JavaFX Project in a way that it can be used in windows,Mac and Linux. 您还可以以可在Windows,Mac和Linux中使用的方式导出JavaFX项目。

    For that you can use the file build.fxbuild and build the project(big topic search for it on internet) 为此,您可以使用文件build.fxbuild并构建项目(在互联网上搜索大主题)

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM