- ubuntu 18.10 — how to install JavaFX with java
- Installing the JavaFX SDK
- Contents
- System Requirements
- Installing the JavaFX SDK on Windows or Mac
- Installing the JavaFX SDK on Ubuntu Linux or OpenSolaris
- More Information
- Discussion
- How to install & run java 8 and javafx on Ubuntu 18.04
- Release: JavaFX 2.2
- 1 JavaFX Installation for Microsoft Windows
- 2 JavaFX Installation for Linux
- 3 JavaFX Installation for Mac OS X
- We Welcome Your Comments
- JavaFX 2.2 Installation Guide
- 2 JavaFX Installation for Linux
- Installing JavaFX
- Installing NetBeans IDE
- How to install JavaFx in Ubuntu 12.04?
- 4 Answers 4
ubuntu 18.10 — how to install JavaFX with java
I have both openjdk8 and 11 installed. Neither comes with JavaFX. I installed both openjfx and libopenjfx-java packages, but can’t get my app to work.
sudo apt list --installed| grep jfx WARNING: apt does not have a stable CLI interface. Use with caution in scripts. libopenjfx-java/cosmic,cosmic,now 11+26-4 all [installed] libopenjfx-jni/cosmic,now 11+26-4 amd64 [installed,automatic] openjfx-source/cosmic,cosmic,now 11+26-4 all [installed] openjfx/cosmic,now 11+26-4 amd64 [installed]
dpkg-query -L openjfx /. /usr /usr/share /usr/share/doc /usr/share/doc/openjfx /usr/share/doc/openjfx/TODO.Debian /usr/share/doc/openjfx/changelog.Debian.gz /usr/share/doc/openjfx/copyright /usr/share/openjfx /usr/share/openjfx/lib /usr/share/openjfx/lib/javafx.properties /usr/share/openjfx/lib/javafx.base.jar /usr/share/openjfx/lib/javafx.controls.jar /usr/share/openjfx/lib/javafx.fxml.jar /usr/share/openjfx/lib/javafx.graphics.jar /usr/share/openjfx/lib/javafx.media.jar /usr/share/openjfx/lib/javafx.swing.jar /usr/share/openjfx/lib/javafx.web.jar
Am I supposed to somewhat copy the libraries to java lib folder? Otherwise it does not compile blabbering not existing javafx.* packages Previously working jar now exits with:
Error: Could not find or load main class helloworld.HelloWorld Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
java --module-path /usr/share/openjfx/lib --add-modules=javafx.controls,javafx.fxml
Caused by: java.lang.IllegalAccessError: class impl.org.controlsfx.version.VersionChecker (in unnamed module @0x28658d1c) cannot access class com.sun.javafx.runtime.VersionInfo (in module javafx.base) because module javafx.base does not export com.sun.javafx.runtime to unnamed module @0x28658d1c at impl.org.controlsfx.version.VersionChecker.(VersionChecker.java:50) at org.controlsfx.control.ControlsFXControl.(ControlsFXControl.java:35) at org.controlsfx.control.CheckComboBox.(CheckComboBox.java:113) at org.controlsfx.control.CheckComboBox.(CheckComboBox.java:104) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at java.base/java.lang.Class.newInstance(Class.java:584) at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1019) at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:754) at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2722) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2552) at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466) at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
Installing the JavaFX SDK
The JavaFX Software Development Kit (SDK) provides the command-line tools and technologies to develop expressive content for applications deployed to browsers, desktops, and mobile devices.
The JavaFX SDK runs on Windows and Mac OS X. A beta release of the JavaFX SDK is provided for Ubuntu Linux and the OpenSolaris operating systems.
Contents
System Requirements
The system requirements for the JavaFX SDK, including the recommended version of the Java SE Development Kit (JDK), are listed in the JavaFX System Requirements document.
Installing the JavaFX SDK on Windows or Mac
On Mac OS X, the installation procedure also creates the following directories:
/Library/Frameworks/JavaFX.framework/Versions/Current /Library/JavaFX/Home /usr/bin/javafx /usr/bin/javafxc /usr/bin/javafxdoc /usr/bin/javafxpackager
For information about samples and documentation in the SDK, see the README file in the top level of the SDK directory.
Installing the JavaFX SDK on Ubuntu Linux or OpenSolaris
chmod a+x javafx_sdk-1_2-linux-i586.sh ./javafx_sdk-1_2-linux-i586.sh
The shell script installs the JavaFX SDK in the current directory.
For information about samples and documentation in the SDK, see the README file in the top level of the SDK directory.
More Information
Discussion
We welcome your participation in our community. Please keep your comments civil and on point. You can optionally provide your email address to be notified of replies your information is not used for any other purpose. By submitting a comment, you agree to these Terms of Use.
How to install & run java 8 and javafx on Ubuntu 18.04
I’d like to install java 8 and javafx on ubuntu 18.04. I installed openjdk-8-jdk , openjfx and openjdk-8-jre via apt but a compilation of hello world app fails since javac is unable to locate javafx .
$ sudo apt install openjdk-8-jdk openjfx openjdk-8-jre $ javac -version javac 1.8.0_191 $ cat App.java import javafx.application.*; import javafx.stage.*; import javafx.scene.*; import javafx.scene.layout.*; public class App extends Application < @Override public void start(Stage primaryStage) < Pane pane = new Pane(); Scene scene = new Scene(pane, 300, 250); primaryStage.setTitle("Hello, World!"); primaryStage.setScene(scene); primaryStage.show(); >public static void main(String[] args) < launch(args); >> $ javac App.java App.java:1: error: package javafx.application does not exist import javafx.application.*; ^ App.java:2: error: package javafx.stage does not exist import javafx.stage.*; ^ App.java:3: error: package javafx.scene does not exist import javafx.scene.*; ^ App.java:4: error: package javafx.scene.layout does not exist import javafx.scene.layout.*; ^ App.java:6: error: cannot find symbol public class App extends Application < .
$ ls /usr/lib/jvm/java-8-openjdk-amd64/bin/ appletviewer java java-rmi.cgi jhat jrunscript keytool rmic servertool xjc extcheck javac jcmd jinfo jsadebugd native2ascii rmid tnameserv idlj javadoc jconsole jjs jstack orbd rmiregistry unpack200 jar javah jdb jmap jstat pack200 schemagen wsgen jarsigner javap jdeps jps jstatd policytool serialver wsimport
$ ls /usr/lib/jvm/ java-1.8.0-openjdk-amd64 java-8-openjdk-amd64
Release: JavaFX 2.2
1 JavaFX Installation for Microsoft Windows
2 JavaFX Installation for Linux
3 JavaFX Installation for Mac OS X
We Welcome Your Comments
If you have questions about JavaFX, please go to the forum.
JavaFX 2.2 Installation Guide
2 JavaFX Installation for Linux
This page provides information about the installation procedures of the JavaFX 2.2 SDK on Linux platforms.
Web Start applications and Web applications (plugin) features are currently not supported on the Linux platform.
Installing JavaFX
The JavaFX 2.2 SDK for Linux is installed as part of JDK 7 update 6 for Linux. See the JDK 7 update 6 platform requirements and installation instructions, see "JDK 7 Installation for Linux" at
http://docs.oracle.com/javase/7/docs/webnotes/install/
If you want to use JavaFX 2.2 on a JDK 6 platform, perform the following:
- Download the JavaFX 2.2 SDK zip file from http://www.oracle.com/technetwork/java/javafx/downloads/index.html
- Extract the SDK files from the zip file to a directory on your local file system. Once JavaFX SDK is installed, you should see the following directory structure on your system: javafx-sdk2.2/
bin/
docs/
rt/
.
..
Installing NetBeans IDE
NetBeans IDE 7.2 is recommended for the JavaFX 2.2 SDK. Download the NetBeans IDE from the JavaFX Downloads page.
For information about configuring NetBeans IDE to run with JavaFX, see Setting Up NetBeans IDE With JavaFX at
http://netbeans.org/kb/docs/java/javafx-setup.html
Copyright © 2008, 2012, Oracle and/or its affiliates. All rights reserved.
Legal Notices Accessibility Statement
How to install JavaFx in Ubuntu 12.04?
I download JavaFx from here. I placed it in my home directory( anto ) under the name javafx . Then I did something like this :
javaFx_home=/anto/javafx/rt/lib/jfxrt.jar export PATH=$PATH:$javaFx_home
4 Answers 4
Automatically: (via webupd8 helper ppa repository)
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer
Note: You can replace oracle-java7-installer with oracle-java8-installer or oracle-java9-installer . You will need to accept the Oracle End User License Agreement prior to installation (this isn't required with OpenJDK, so if a OpenJDK back-port is released for 12.04, please update this post! 🙂
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
You can try setting the CLASSPATH instead of PATH . Java tries to load it's classes from the locations referenced by CLASSPATH .
- First check your existing classpath with echo $CLASSPATH . Like PATH , the entries for CLASSPATH are separated with : (colon). The presence of a . entry under CLASSPATH means java can always load classes from current directory.
- To add a .jar library to your CLASSPATH you should open the file ~/.profile and add export CLASSPATH=$CLASSPATH:path to .jar to it. Like in your case it should be
javaFx_home=/home/anto/javafx/rt/lib/jfxrt.jar
export CLASSPATH=$CLASSPATH:$javaFx_home
Here is what I've found so far.
I downloaded JavaFX SDK 1.2 and 2.2 . They have removed some files from JavaFX SDK.
virpara@Ascension:~$ tree -L 2 '/home/virpara/Desktop/javafx-sdk1.2' /home/virpara/Desktop/javafx-sdk1.2 |-- bin | |-- javafx | |-- javafxc | |-- javafxdoc | `-- javafxpackager |-- COPYRIGHT.html |-- docs | |-- api | |-- emulator.html | |-- index.html | |-- javafxc.html | |-- javafxdoc.html | |-- javafx.html | |-- javafxpackager.html | `-- manpage.css |-- emulator | `-- bin |-- invoice.properties |-- lib | |-- desktop | |-- javafx-runtime.properties | |-- mobile | `-- shared |-- LICENSE.txt |-- profiles | |-- desktop.properties | `-- mobile.properties |-- README.html |-- samples | |-- DisplayShelf | |-- DisplayShelfMobile | |-- DragAndDrop | |-- index.html | |-- InterestingPhotos | |-- LocalSearch | |-- MediaBox | |-- PathAnimation | |-- PhotoEffects | |-- PhotoFlip | |-- shared | `-- SpringAnimation |-- servicetag | `-- registration.jar |-- src.zip |-- THIRDPARTYLICENSEREADME.txt `-- timestamp 23 directories, 23 files
virpara@Ascension:~$ tree -L 2 '/home/virpara/Desktop/javafx-sdk2.2.0-beta' /home/virpara/Desktop/javafx-sdk2.2.0-beta |-- bin | `-- javafxpackager |-- COPYRIGHT.html |-- docs | `-- api |-- lib | |-- ant-javafx.jar | |-- javafx-doclet.jar | `-- javafx-mx.jar |-- README.html |-- rt | |-- COPYRIGHT.html | |-- lib | |-- README.html | `-- THIRDPARTYLICENSEREADME.txt `-- THIRDPARTYLICENSEREADME.txt 6 directories, 10 files
There is only javafxpackager script in javafx-sdk2.2.0-beta/bin ( javafx, javafxc, javafxdoc scripts are removed) it means that if you export javafx-sdk2.2.0-beta/bin to your PATH variable and try to execute javafx --version in terminal it can't find javafx because there is no executable named javafx .
Well I've no experience with JavaFX but probably they have removed other three scripts because it would not be needed and perhaps javafxpackager would do the thing or java is enough for that.
You've tried to include whole path to jfxrt.jar to PATH variable.
it won't work because it can't automatically pass to -cp parameter. So, you must give full path to jfxrt.jar as -cp /anto/javafx/rt/lib/jfxrt.jar
java -cp /anto/javafx/rt/lib/jfxrt.jar MyProgram.java
I know it is not a solution.