使用 Eclipse 将 JavaFX 项目导出为可运行的 [英] Export JavaFX Project to a runnable using Eclipse

查看:57
本文介绍了使用 Eclipse 将 JavaFX 项目导出为可运行的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Eclipse 并在 javaFX 中制作一个简单的游戏.我有图像,需要将它们和 javafx 打包到一个可运行的文件中.我没有使用任何与 javafx 相关的 css 东西,只是基本的窗口和阶段等等.谢谢!

我曾尝试将其导出,但没有奏效.

解决方案

  • 第 1 部分

    JavaFX Eclipse 项目类似于:

因此,通过上述内容,您可以确定每个图书馆和资源都将在

1)进入最终的罐子

2) 您将有一个最终的 Jar 和一个单独的文件夹,其中包含您正在使用的所有外部库.

3) (2)+其他资源的外部文件夹

<块引用>

导出项目:

1)右键点击项目

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

3)选择你的主班

4) 在库处理上,这是您的选择(最好选择 3rd 选项,因为它可以防止包含相同类的库发生冲突,并且不会违反某些库许可)

5)导出

<块引用>

终于

也看看这个

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.

解决方案

  • Part 1

    A JavaFX Eclipse Project is like:

So with the above you are sure that every library and resource will be in the

1)Into the final Jar

or

2)You will have a final Jar and a separate folder which contains all the external libraries you are using.

or

3) (2)+External Folder for other resources

Exporting the Project:

1)Right Click on the Project

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

3)Choose your main class

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)Export It

Finally

Also have a look at this link which was provided in the comments.

  • Part 2)

After you have done the above you can use Launch4J to package your jar file into an .exe file(for Windows)

  • Part 3)

    You can also export your JavaFX Project in a way that it can be used in windows,Mac and Linux.

    For that you can use the file build.fxbuild and build the project(big topic search for it on internet)

这篇关于使用 Eclipse 将 JavaFX 项目导出为可运行的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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