本文介绍了我的GMapsFX库文件出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将GMapsFX库链接到FXML文件,但是在尝试打开实际的地图页面时,此错误始终出现.
I'm trying to link a GMapsFX library to an FXML file but this error keeps appearing when trying to open the actual map page.
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文件,但我认为可能是错误的.
I have already downloaded the correct JAR files but I feel it may be an error with that.
这是错误:
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
推荐答案
阅读消息:
您需要将slf4j-.jar添加到您的类路径中:
You need to add slf4j-.jar to your classpath:
https://www.slf4j.org/download.html
对于新项目,我强烈建议使用依赖管理工具,例如 maven 或 gradle .它使依赖项的处理更加容易.
For new projects I sugeest to use an dependency management tool like maven or gradle. It makes the handling of dependencies much more easier.
这篇关于我的GMapsFX库文件出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!