[英]How do I fix permission to allow IntelliJ IDEA to run a Kotlin script?
I am trying to run the below Kotlin script from IntelliJ IDEA 2020.3.1 on Mac OS 10.15.7.我正在尝试在 Mac OS 10.15.7 上从 IntelliJ IDEA 2020.3.1 运行以下 Kotlin 脚本。 The script runs fine from terminal, but when I hit the 'run' button inside of IntelliJ, I get the following error:该脚本从终端运行良好,但是当我点击 IntelliJ 内的“运行”按钮时,出现以下错误:
zsh: permission denied: /Users/*****/scripts/first.main.kts zsh:权限被拒绝:/Users/*****/scripts/first.main.kts
What would be the right way to fix this permission issue?解决此权限问题的正确方法是什么?
#!/usr/bin/env kotlin
@file:Repository("https://jcenter.bintray.com")
@file:DependsOn("org.http4k:http4k-bom:4.1.1.2")
@file:DependsOn("org.http4k:http4k-core:4.1.1.2")
@file:DependsOn("org.http4k:http4k-client-apache:4.1.1.2")
@file:DependsOn("org.http4k:http4k-server-netty:4.1.1.2")
import org.http4k.client.ApacheClient
import org.http4k.core.Method
import org.http4k.core.Request
val client = ApacheClient()
val request = Request(Method.GET, "https://api.kanye.rest/").query("format", "text")
println(client(request))
You must make the file executable: chmod +x first.main.kts
您必须使文件可执行: chmod +x first.main.kts
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.