I recently installed Oracle JDK 1.8 on my Kubuntu Linux machine following this guide. I did the manual install because I couldn't get the easy one to work.

If I've understood correctly, javafx should be included on the default classpath after installing Oracle JDK 1.8. This is not the case for me: I need to manually add the jfxrt.jar file to the classpath for each new project.

Java -version in terminal gives:

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

How can I fix this so that jfxrt.jaris always on the default classpath?

  • You have to add CLASSPATH. Check my answer for details. – Faizan Akram Dar Apr 16 '15 at 10:20
  • Please provide the output of javac -version. – Puce Apr 16 '15 at 10:30
  • Please should the error you had using the PPA, since it's really the most convenient way to install and update Oracle Java on Kubuntu and it helps with environment variables, too. – Puce Apr 16 '15 at 10:31
  • Cross-posted here: stackoverflow.com/questions/29662452/… – Puce Apr 16 '15 at 10:31
  • @Puce This question was posted at Stack Overflow first and then Sifu was told at Stack Overflow to post it here. This question must belong somewhere. It's being answered here not at SO, so why not keep it here? – karel Apr 16 '15 at 10:33

You need to set up CLASSPATH in /etc/environment. Execute the following command in a terminal (Ctrl+Alt+T)

sudo gedit /etc/environment

Add the following lines (all four lines at the end of /etc/environment)

export JAVA_HOME

Alternatively you can add CLASSPATH to /etc/profile.d/oraclejdk.sh if you have used this guide.

export CLASSPATH="/usr/lib/jvm/oracle_jdk8/lib"
  • It shoudln't be needed to add jfxrt.jar to the classpath since it uses the extension mechanism. – Puce Apr 16 '15 at 10:27
  • Since I followed the guide specified I tried the alternative method and it works great. Thanks. – Sifu Apr 16 '15 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.