我试图在IntelliJ中启动一个新的JDK 9项目,但是当我尝试运行它时,我在make过程中遇到以下错误:
错误:java:invalid flag:-release
我知道我没有正确设置但似乎无法找到任何与在IntelliJ中使用Jigsaw建立项目有关的内容.
编辑 这是该问题的屏幕截图.无法在任何地方找到与此相关的任何内容.
我在IDE中没有编译器错误.它只是在build/run命令上失败了.这是一个干净的IntelliJ安装,新的项目从JDK 9开始.
我在从HttpRequest JavaDoc编译简单的阻塞GET示例时遇到问题:
package org.example;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import static java.net.http.HttpRequest.noBody;
import static java.net.http.HttpResponse.asString;
public class Http2 {
public static void main(String[] args) throws URISyntaxException, IOException, InterruptedException {
HttpResponse response = HttpRequest
.create(new URI("http://www.infoq.com"))
.body(noBody())
.GET().response();
int responseCode = response.statusCode();
String responseBody = response.body(asString());
System.out.println(responseBody);
}
}
Run Code Online (Sandbox Code Playgroud)
package java.net.http does not exist使用JDK 9进行编译时遇到错误:
{ jdk9 } » /cygdrive/c/Program\ Files/Java/jdk-9/bin/javac -d out/production -modulesourcepath org.example.module1/src/ -m org.example.module1
org.example.module1\src\org.example.module1\org\example\Http2.java:6: error: package java.net.http does not exist
import …