我的GMapsFX库文件有错误

时间:2018-12-18 16:20:15

标签: java google-maps javafx google-maps-api-3 fxml

因此,在某些情况下,我正在做一个很长的项目,我无法弄清楚此错误是什么问题?有任何想法吗。尝试将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

1 个答案:

答案 0 :(得分:0)

阅读消息:

  

java.lang.ClassNotFoundException:org.slf4j.LoggerFactory

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

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

对于新项目,我建议使用mavengradle之类的依赖项管理工具。它使依赖项的处理更加容易。