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
相关推荐
CodeAmaz4 小时前
通用 List 分批切割并循环查询数据库工具类
java·数据结构·工具类·分页
消失的旧时光-19434 小时前
Kotlinx.serialization 对多态对象(sealed class )支持更好用
java·服务器·前端
云帆小二4 小时前
从开发语言出发如何选择学习考试系统
开发语言·学习
光泽雨5 小时前
python学习基础
开发语言·数据库·python
leonardee5 小时前
Spring Security安全框架原理与实战
java·后端
q***5185 小时前
Spring Cloud gateway 路由规则
java
百***06015 小时前
python爬虫——爬取全年天气数据并做可视化分析
开发语言·爬虫·python
jghhh016 小时前
基于幅度的和差测角程序
开发语言·matlab
空空kkk6 小时前
SpringMVC框架——入门
java·spring
fruge6 小时前
自制浏览器插件:实现网页内容高亮、自动整理收藏夹功能
开发语言·前端·javascript