You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ant/Make构建时含空格路径导致jni.h找不到编译报错问询

ant/make构建C++模块时含空格的JDK头文件路径识别失败问题

无法提供可复现该问题的最小样例,以下为问题的具体情况:

  • 项目使用ant/make作为构建工具
  • 构建C++模块时,需要在头文件包含路径中引用Java安装目录下的jni.h头文件

构建过程报错

致命编译错误

File.h(2): fatal error C1083: Cannot open include file: 'jni.h': No such file or directory
make: *** [File.obj] Error 2

同步输出的编译警告

cl : Command line warning D9024 : unrecognized source file type 'Files\Java\jdk1.8.0_281\include', object file assumed
cl : Command line warning D9027 : source file 'Files\Java\jdk1.8.0_281\include' ignored
cl : Command line warning D9024 : unrecognized source file type 'Files\Java\jdk1.8.0_281\include\win32', object file assumed
cl : Command line warning D9027 : source file 'Files\Java\jdk1.8.0_281\include\win32' ignored

已确认的信息

  • 编译步骤配置的头文件包含参数为-IC:\Program Files\Java\jdk1.8.0_281\include,对应路径在本地真实存在
  • 测试验证:将相关依赖文件拷贝到无空格的路径(如C:\ProgramFiles\Java\...)下时,构建可正常执行完成
  • 构建使用的JDK_HOME变量从.platform配置文件读取,供ant/make构建流程调用

待解决的疑问

目前已定位到问题根源是Program Files路径中的空格,但不清楚ant/make处理含空格包含路径的规则,查阅相关资料未找到对应解决方案,需要有相关经验的开发者提供排查思路或解决方向。


内容的提问来源于stack exchange,提问作者Omid CompSCI

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.27 22:57:09