Universal Robots+

How to use JavaFX in a URCap

This question has already been asked before in this forum by another user (here), but it did not receive any answer, so I describe my question and problem in more detail.

I want to use the JavaFX library in a URCap. I have managed to use my own external libraries (.JAR) but I have not been able to use this library. As I have investigated (source) it is caused because in Java 8 the javafx.* packages are in the JRE, but OSGi does not export them automatically and hence the error appears:

I have tried to solve it (source) by adding the following lines in the pom.xml file, within the <properties> section, in order to force the export of the necessary packages:




But it has not worked, the same error continues. Maybe someone has used JavaFX and can give some advice. Thank you!

I recently had a similar problem with a library I imported. Under < configuration> < /configuration> you will have a < Import-Package> < Import-Package> section try add org.osgi.* to it. (Most likely will have to add more than that but start with these and see what happens).

Then under < dependencies> section you are going to want to add necessary libraries needed for JavaFX. https://mvnrepository.com/artifact/javafx/javafx/2.2.7 ----> It will look like this in the dependency section.

Edit: I was able to build my project out with the JavaFX.base library, try adding this dependency image


Hi Roman,
Thank you for your answer. I have tried to import (<Import-Package>), export (<Export-Package>), embed (<Embed-Dependency>) and add many dependencies (<dependency>) but I still have not managed to solve the problem.

When adding the JavaFX maven repository that you have indicated to me (javafx), I get an error when compiling (it seems that the repository is no longer updated):


About adding the org.osgi.core dependency, it is already added by default in my pom.xml file. How exactly did you incorporate javafx.base?

Thank you :slight_smile:

I added the external jar for javafx.base to my project and was able to compile. What is every dependencies and import you have in pom.xml? I am no expert in these by any means. Basically I just kept googling and importing packages into my project until I was able to compile in the past. I know that adding that org.osgi dependency resolved a couple issues I was having so I would start there. https://stackoverflow.com/a/27289817 this explains the error you show in the picture above.

I have managed to add all the required libraries following the instructions I found from another user (here).
Dependency errors no longer appear, but a new error related to the Activator class appears now:

I keep investigating.


I am not aware of anyone that have gotten Java FX to work on the robots.

The robots are using Open JDK 8. Without looking a lot into it, I believe that support for Java FX is not automatically included in Open JDK 8. This means that is is not enough to resolve all dependencies from an OSGi perspective. You would probably also need special packages on the OS level.

It might be possible to hack a robot to get Java FX to work. But assuming that your end goal is to make a UR+ plugin that works on any e-Series robots, then it is a much more difficult task.

The CB3 robots use an older Open JDK, thus making it even more difficult to get Java FX in there.



Sorry to dig up an old topic, but did anyone ever find a method to implement any JFX at all? I would like to try and use a WebPane in order to display the web client configuration from a peripheral drive unit which is connected to the robots ethernet port. I have tried using a JEditorPane, however is does not have the features (CSS, HTML > 3.2 or javascript) required to render the webpage, and after some googling, the other option seems to be implementing some JFX. Unfortunately as I am intergrating to this equipment, I have no control over the web page being fetched.
Many thanks

Sorry, I kept trying but couldn’t get JavaFX to work.

Me neither, unforunately I’ve had to scrap the idea as impossible.