What's the location of the JavaFX runtime JAR file, jfxrt.jar, on Linux?

前端 未结 4 856
灰色年华
灰色年华 2020-12-05 02:01

I\'m trying to run some JavaFX code with Eclipse Kepler, with e(fx)clipse plugin installed, on a Linux machine, using:

java version \"1.7.0_21\"
OpenJDK Runt         


        
相关标签:
4条回答
  • 2020-12-05 02:03

    The location of jfxrt.jar in JDK 1.8 (Windows) is:

    C:\Program Files\Java\jdk1.8.0_05\jre\lib\ext\jfxrt.jar
    
    0 讨论(0)
  • 2020-12-05 02:07

    The location of jfxrt.jar in Oracle Java 7 is:

    <JRE_HOME>/lib/jfxrt.jar
    

    The location of jfxrt.jar in Oracle Java 8 is:

    <JRE_HOME>/lib/ext/jfxrt.jar
    

    The <JRE_HOME> will depend on where you installed the Oracle Java and may differ between Linux distributions and installations.

    jfxrt.jar is not in the Linux OpenJDK 7 (which is what you are using).


    An open source package which provides JavaFX 8 for Debian based systems such as Ubuntu is available. To install this package it is necessary to install both the Debian OpenJDK 8 package and the Debian OpenJFX package. I don't run Debian, so I'm not sure where the Debian OpenJFX package installs jfxrt.jar.


    Use Oracle Java 8.

    With Oracle Java 8, JavaFX is both included in the JDK and is on the default classpath. This means that JavaFX classes will automatically be found both by the compiler during the build and by the runtime when your users use your application. So using Oracle Java 8 is currently the best solution to your issue.

    OpenJDK for Java 8 could include JavaFX (as JavaFX for Java 8 is now open source), but it will depend on the OpenJDK package assemblers as to whether they choose to include JavaFX 8 with their distributions. I hope they do, as it should help remove the confusion you experienced in your question and it also provides a great deal more functionality in OpenJDK.

    My understanding is that although JavaFX has been included with the standard JDK since version JDK 7u6

    Yes, but only the Oracle JDK.

    The JavaFX version bundled with Java 7 was not completely open source so it could not be included in the OpenJDK (which is what you are using).

    In you need to use Java 7 instead of Java 8, you could download the Oracle JDK for Java 7 and use that. Then JavaFX will be included with Java 7. Due to the way Oracle configured Java 7, JavaFX won't be on the classpath. If you use Java 7, you will need to add it to your classpath and use appropriate JavaFX packaging tools to allow your users to run your application. Some tools such as e(fx)clipse and NetBeans JavaFX project type will take care of classpath issues and packaging tasks for you.

    0 讨论(0)
  • 2020-12-05 02:12

    On Ubuntu with OpenJDK, it installed in /usr/lib/jvm/default-java/jre/lib/ext/jfxrt.jar (technically its a symlink to /usr/share/java/openjfx/jre/lib/ext/jfxrt.jar, but it is probably better to use the default-java link)

    0 讨论(0)
  • 2020-12-05 02:24

    Mine were located here on Ubuntu 18.04 when I installed JavaFX using apt install openjfx (as noted already by @jewelsea above)

    /usr/share/java/openjfx/jre/lib/ext/jfxrt.jar
    /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jfxrt.jar
    
    0 讨论(0)
提交回复
热议问题