ArcGIS Runtime Java SDK初始化报错:Could not find runtime

在使用ArcGIS Runtime Java SDK进行开发时,遇到以下错误信息:

复制代码
Initializing...
Java version : 11.0.26 (Oracle Corporation) x86_64
Exception in thread "main" java.lang.ExceptionInInitializerError
	at com.esri.arcgisruntime.geometry.SpatialReference.<init>(SpatialReference.java:151)
	at com.esri.arcgisruntime.geometry.SpatialReference.create(SpatialReference.java:88)
	at org.example.shp_ram.demo.MemoryShapefileParserWithVFS.<clinit>(MemoryShapefileParserWithVFS.java:29)
Caused by: java.lang.RuntimeException: Could not find runtime in any of:
- A directory specified by calling ArcGISRuntimeEnvironment.setInstallDirectory()
- The current directory /Users/carter/Desktop/firm/gis_study
- A location specified by the environment variable ARCGISRUNTIMESDKJAVA_100_15_0
- Within the ".arcgis" directory in the user's home path /Users/carter/.arcgis
	at com.esri.arcgisruntime.ArcGISRuntimeEnvironment.lambda$getInstallDirectory$0(ArcGISRuntimeEnvironment.java:285)
	at java.base/java.util.Optional.orElseThrow(Optional.java:408)
	at com.esri.arcgisruntime.ArcGISRuntimeEnvironment.getInstallDirectory(ArcGISRuntimeEnvironment.java:281)
	at com.esri.arcgisruntime.ArcGISRuntimeEnvironment.loadNativeLibraries(ArcGISRuntimeEnvironment.java:795)
	at com.esri.arcgisruntime.ArcGISRuntimeEnvironment.initialize(ArcGISRuntimeEnvironment.java:221)
	at com.esri.arcgisruntime.internal.jni.CoreSpatialReference.<clinit>(CoreSpatialReference.java:41)
	... 3 more

报错图片:

这个错误的核心问题是:系统找不到ArcGIS Runtime的本地库文件。

1.问题根源分析

(1)ArcGIS Runtime Java SDK由两部分组成:

(2)Java API - 纯Java代码,通过Maven依赖引入

本地库文件 - 平台相关的本地动态库(Windows的dll、Linux的so、macOS的dylib)

错误提示表明系统在以下位置都找不到本地库文件:

通过代码设置的安装目录

当前工作目录

环境变量指定的目录

用户home目录下的.arcgis文件夹

2.解决方案

在项目目录下执行以下命令

复制代码
mvn dependency:unpack
相关推荐
星火开发设计1 小时前
枚举类 enum class:强类型枚举的优势
linux·开发语言·c++·学习·算法·知识
喜欢吃燃面6 小时前
Linux:环境变量
linux·开发语言·学习
徐徐同学7 小时前
cpolar为IT-Tools 解锁公网访问,远程开发再也不卡壳
java·开发语言·分布式
LawrenceLan7 小时前
Flutter 零基础入门(二十六):StatefulWidget 与状态更新 setState
开发语言·前端·flutter·dart
m0_748229997 小时前
Laravel8.X核心功能全解析
开发语言·数据库·php
qq_192779877 小时前
C++模块化编程指南
开发语言·c++·算法
Mr.朱鹏8 小时前
Nginx路由转发案例实战
java·运维·spring boot·nginx·spring·intellij-idea·jetty
代码村新手8 小时前
C++-String
开发语言·c++
qq_401700418 小时前
Qt 中文乱码的根源:QString::fromLocal8Bit 和 fromUtf8 区别在哪?
开发语言·qt