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
相关推荐
PPPHUANG8 小时前
一次 CompletableFuture 误用,如何耗尽 IO 线程池并拖垮整个系统
java·后端·代码规范
恩创软件开发8 小时前
创业日常2026-1-8
java·经验分享·微信小程序·小程序
lly2024068 小时前
jEasyUI 设置排序指南
开发语言
一起努力啊~9 小时前
算法刷题--长度最小的子数组
开发语言·数据结构·算法·leetcode
想用offer打牌9 小时前
一站式了解Spring AI Alibaba的流式输出
java·人工智能·后端
Lonely丶墨轩9 小时前
从登录入口窥见架构:一个企业级双Token认证系统的深度拆解
java·数据库·sql
还债大湿兄9 小时前
huggingface.co 下载有些要给权限的模型 小记录
开发语言·前端·javascript
bkspiderx9 小时前
C++中的map容器:键值对的有序管理与高效检索
开发语言·c++·stl·map
Hard but lovely9 小时前
Linux: 线程同步-- 基于条件变量 &&生产消费模型
linux·开发语言·c++
汤姆yu9 小时前
基于python大数据的协同过滤音乐推荐系统
大数据·开发语言·python