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

为什么Kotlin在线编辑器会抛出FileNotFoundException异常?

Kotlin在线运行环境executor.policy文件缺失异常解决办法

报错堆栈信息:

Exception in thread "main" java.io.FileNotFoundException: /var/task/tmp/c2490bcf8f0044b7a1d665799dd03876/executor.policy (No such file or directory)
at java.io.FileOutputStream.open0 (FileOutputStream.java:-2) 
at java.io.FileOutputStream.open (FileOutputStream.java:270) 
at java.io.FileOutputStream.<init> (FileOutputStream.java:213)

该错误由在线Kotlin运行沙箱的安全策略配置文件缺失导致,可根据使用场景选择对应解决方法:

  • 普通用户使用第三方在线编辑器运行代码
    • 直接更换为官方维护的Kotlin在线运行环境即可,无需修改任何代码
    • 若坚持使用当前编辑器,检查你编写的代码中是否包含手动写入本地文件、指定安全策略文件路径的逻辑,删除对应逻辑后重新运行
  • 自行搭建在线Kotlin运行环境的开发者
    • 进入报错提示的目录:cd /var/task/tmp/c2490bcf8f0044b7a1d665799dd03876/
    • 手动创建空的权限配置文件:touch executor.policy
    • 给文件配置沙箱运行所需的读写权限:chmod 644 executor.policy
    • 重启Kotlin运行服务进程后即可恢复正常

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.25 23:45:00