4

I want to use JavaFX in Ubuntu. According to this link, I have to install libavcodec53 and libavformat53. I googled and came across sites like this, which suggests to use

sudo apt-get update
sudo apt-get install libavcodec53

for Ubuntu 12.04 and 14.04. I am using 16.04 version and for me the above commands did not work.

I also used the below command

sudo apt-get install libav-tools

But when I gave sudo apt-cache search libav | grep extra-, it didn’t give me any result.

So how am I supposed to install libavcodec53 and libavformat53 so that I can use JavaFx in Ubuntu 16.04?

karel
  • 122,292
  • 133
  • 301
  • 332
george
  • 141

1 Answers1

4

You can either download JavaFX from the official Oracle website or install JavaFX from the default Ubuntu repositories.

Oracle JavaFX

As of JDK 7u6 JavaFX is included with the standard JDK and JRE bundles. Please download the JDK or JRE to use JavaFX. Oracle Java Installation instructions are at this question: How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE?.

On the same Oracle Java download page there is another link to download a Java SE Development Kit (JDK) Cobundle which contains JDK 8 with NetBeans IDE.


Ubuntu JavaFX

In the Ubuntu 16.04 and later default repositories JavaFX is packaged as a separate package named openjfx. To install it, open the terminal and type:

sudo apt install default-jdk openjfx  

This command is a complete alternative to installing Oracle Java and JavaFX. Optionally you can install openjdk-11-jdk instead of or alongside openjdk-8-jdk in Ubuntu 18.04, and openjfx works with both JDKs.

You can also install NetBeans with this command:

sudo apt install netbeans  

JavaFX can run all the JavaFX examples from the "Getting Started with JavaFX" tutorials at the official Oracle website successfully. The only difference from the Oracle tutorials is that in NetBeans openjfx doesn't add a JavaFX Application entry in the File -> New Project -> Java category, so you need to select Java Application instead.

karel
  • 122,292
  • 133
  • 301
  • 332