Need help whit JavaFx installation for Video presentation in game

Hello, am trying to add a video in my game as the background for my connection page and after some searching, I realize that the best way to do it was to use JavaFX and that JME already had a little something for that: GitHub - empirephoenix/JME3-JFX: JFX Gui bridge for JME with usefull utilities for common usecases

Problem is, I really don’t underhand how am supposed to connect that to my game xD. Am using eclipse and I have downloaded the project using git. I saw somewhere that I could not create a jar out of it, and that I should use maven, but anyway the project is not considered as a Java project but a simple project keeping me from making a jar whit it

So I installed maven, but when I convert the project into a maven project, it show me a lot of errors everywhere. I guess my eclipse version is not totally up to date, but would it really help or I am doing something wrong?

Plus it doesn’t seem like any real tutorial is out there. Some part here and there, but nothing clear, and as this it kinda the only way to get video in (and do some really cool stuff to x) I was wondering why. I do underhand it’s not finish, but when it will, is it expect to be one for it.


  • Dowload the jar and add it : Package jfx - empirephoenix

  • Be sure your java is at 1.8, dowload and install the lates version if not. It can get tricky, i warn you x)

  • If not already done go check and add javaFx jar from your java librairie. It should be in something like that : C:\Program Files\Java\jre1.8.0_51\lib\ext\jfxrt.jar

  • You should now be able to use javaFx in JME! If you want it in a 3D enviroment, follow this link : JME3-JFX/ at master · empirephoenix/JME3-JFX · GitHub

  • If you want to add it in a 2D enviroment use this while having somewhere in your code this line called befaure : new JFXPanel() (take note this code is using toneGod GUI ;

    public class MovieLabel extends Label

      private MovieMaterial  movieMaterial;
      private MediaPlayer mp;
      private MovieLabel link ;
      public MovieLabel(
              ElementManager screen, 
              Vector2f position,
              Vector2f dimensions,
              String videoPath,
              boolean looping) 
          super(screen, position, dimensions);
          link = this ; 
          final Media media = new Media(new File(videoPath).toURI().toASCIIString()) ;
          media.errorProperty().addListener(new ChangeListener<MediaException>() 
              public void changed(final ObservableValue<? extends MediaException> observable, final MediaException oldValue, final MediaException newValue) 
          mp = new MediaPlayer(media);
          {mp.setCycleCount( ;}
          movieMaterial = new MovieMaterial(app,, false);
      public void playIt()
          new animateIt() ;
      private class animateIt extends  AbstractControl
          protected void controlRender(RenderManager arg0, ViewPort arg1)
          protected void controlUpdate(float arg)


I use jitpack and a modified gradle script…

repositories {
    maven {
        url ""

dependencies {
        compile 'com.github.zzuegg:JME3-JFX:aaf6e4082b'

Of fork it and replace zzuegg with your github username.
Somehow the resources folder is not included in the build, so you have to copy the cursors to your project. Did not yet have time to solve that issue.

1 Like

just use gradle to build yourself or bintray where the official release is at.

The project uses gradle for building, not maven.
if you want it as eclipse orject,
→ install gradle
run in folder with cmd:
gradle eclipse

then import.

1 Like

Edit : Am working on it, il get back when i tested a few things

I go whit the gradle thing but i get an errors :

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘C:\Users\Simon\Documents\JME3-JFX\build.gradle’ line: 13

  • What went wrong:
    A problem occurred evaluating root project ‘jfx’.

Cannot run program “git”: CreateProcess error=2, Le fichier spécifié est introuvable

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Any solution?

Ah yes, you need git installed in a way, that it can be called from cmd.

1 Like

Well git is install, i have a feelling it have something to do whit my enviroment variables, but it seem like am not doing the right thing. I put it in path, i put it in it own space but nothing work xD

Il restard my computer and see if it help in any ways

If you need video playback only then just grab all files that you need and add them into your project. I did it this way.

As far as I remember you need only Movie.j3md (with shaders), TextureMovie and ImageExchanger. The code is written so well that it is easy to use it even as GUI object.

1 Like

True that, or grab the already build jar from bintray and just include it.

1 Like

Edit : My bad, the jar do work, i think am just not using the right class.

So… what next? I saw an exemple by abies

But it don’t seem to work at all :/. I can’t creat the class media and mediaPlayer don’t want to be imported. For the texture il guess its a texture il apply the surface i want to video on?

I don’t know if it would help you, since I’m using eclipse and Java 1.7, but I put jfxrt.jar (JavaFX) into my classpath.

1 Like

i am also using eclipse and work whit java 1.7, but i don’t seem to be able to doawload the javaFX jar anywhere.

But i also see everywhere that javaFx need to be install on the computer. Does that mean it will need to be package whit my installer if i want people to be able to use it in game?

see the full source of abies fragment in the test directory of JME-JFX

JME-JFX require java8. under eclipse you may need to add/enable the javafx Library, because it can be hide iirc.

1 Like

I’m afraid but in that classes I mentioned before, there is some code that needs Java 8. That code can be replaced, but probably you’ll need to add those files into your project instead of using precompiled jar.

JavaFX is included into JRE/JDK from 1.7.0 update 45 (or something like that). Check if you have jfxrt.jar somewhere inside your installation.

Thanks! Il have to check that tomorow or i won’t sleep the whole night but il give you feedback when its done!

if you want to try javafx for java 7 + maven/gradle take look at Maybe the Movie part of JME-JFX doesn’t require javafx 8 -but there are lot changes javafx (7) and 8

You where right, its inside java itself, now i only have on problem left : what is that

PlatformImpl.startup(() → { });

i do underthant that startup need a runnable argument but what is () → { } suppose to mean?

It’s a lambda, java 8 new feature.

the hacky solutin is “new JfxPanel()” instead, that starts up the platform as well.

1 Like

And it work! Marvellous! All is left is to make sure it take the whole screen no matter the size and then some integration, but i can do that on my own :wink:

Thanks again :smiley: I’ll soon post the results and try to put every anwser at the begening of the topic if anyone was in need to do the same x).

Okay everything is working great in the testing class but as soon as i get it out of there, i get a green screen. Am applying the texture on a Label build in tonegod, and as i said it work when every part of the code are in the same area. The green screen also play the music. Il get back after a few test

Okay found it. It was actully the
public void simpleUpdate(float tpf) {

But i kinda wonder, won,t that slow in any way my whole program having this command looping all the time? I could probably put it in a AbstractControl to avoid that? o well any way il have to test that later, il come back whit a complet class

Did you see I've made a MovieAppState so you don't have to ?