我的GMapsFX库文件出现错误



我正试图将GMapsFX库链接到FXML文件,但在尝试打开实际地图页面时,此错误不断出现。

FXML文件:

<?xml version="1.0" encoding="UTF-8"?>
<?import com.lynden.gmapsfx.GoogleMapView?>
<?import javafx.scene.layout.AnchorPane?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" 
minWidth="-Infinity" prefHeight="602.0" prefWidth="540.0" 
xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<GoogleMapView layoutY="1.0" prefHeight="602.0" prefWidth="540.0" />
</children>
</AnchorPane>

我已经下载了正确的JAR文件,但我觉得这可能是一个错误。

错误如下:

Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at com.lynden.gmapsfx.GoogleMapView.<clinit>(GoogleMapView.java:55)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:51)
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1009)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:746)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at SignInAfterPage.SignInAfterPageController.createScene2(SignInAfterPageController.java:60)
at SignInAfterPage.SignInAfterPageController.openMapPage(SignInAfterPageController.java:41)
... 58 more
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 78 more

阅读消息:

java.lang.ClassNotFoundException:org.slf4j.LoggerFactory

您需要将slf4j-.jar添加到类路径:

https://www.slf4j.org/download.html

对于新项目,我建议使用像maven或gradle这样的依赖性管理工具。它使依赖关系的处理更加容易。

相关内容

  • 没有找到相关文章