Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export JavaFX Project to a runnable using Eclipse

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.

like image 653
joe n Avatar asked Sep 26 '16 18:09

joe n


1 Answers

  • Part 1

    A JavaFX Eclipse Project is like:

enter image description here

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...

enter image description here

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)

enter image description here

like image 63
GOXR3PLUS Avatar answered Nov 03 '22 06:11

GOXR3PLUS