maven : package javafx.scene.layout does not exist

foreword

  • The project that is normally compiled locally is abnormal when it is compiled on the server
  • Server: TencentOS Server 3.1
  • jdk:openjdk version “1.8.0_352” / OpenJDK Runtime Environment (Tencent Kona 8.0.12) (build 1.8.0_352-b1)

mistake

package javafx.scene.layout does not exist
  • Missing JavaFX library

Solution 1

<dependency>
    <groupId>jre_lib</groupId>
    <artifactId>jfxrt</artifactId>
    <version>1.8</version>
    <scope>system</scope>
    <systemPath>${basedir}/src/main/jre_lib/jfxrt.jar</systemPath>
</dependency>
  • 项目目录/src/main/jre_libIn the directory where jfxrt.jar is copied

Solution 2

Copy jfxrt.jar to $JAVA_HOME/jre/lib/extthe directory

  • $JAVA_HOMEfor the jdk directory

Guess you like

Origin blog.csdn.net/sayyy/article/details/131232775