gpt4 book ai didi

java - Gradle编译Java失败sun.net.www.protocol.http.ntlm.NTLMAuthenticationCallback

转载 作者:行者123 更新时间:2023-12-03 05:51:36 25 4
gpt4 key购买 nike

我在Java文件中使用sun.net.www.protocol.http.ntlm.NTLMAuthenticationCallback

该代码可从Idea构建并正常运行,但在使用gradle compileJava时会失败。

我收到此错误:

D:\source\msnavclient\MsNavClient.java:5: error: package sun.net.www.protocol.http.ntlm does not exist
import sun.net.www.protocol.http.ntlm.NTLMAuthenticationCallback;
^
D:\source\msnavclient\MsNavClient.java:20: error: cannot find symbol
NTLMAuthenticationCallback.setNTLMAuthenticationCallback(new NTLMAuthenticationCallback()
^
symbol: class NTLMAuthenticationCallback
location: class MsNavClient
D:\source\msnavclient\MsNavClient.java:20: error: cannot find symbol
NTLMAuthenticationCallback.setNTLMAuthenticationCallback(new NTLMAuthenticationCallback()
^
symbol: variable NTLMAuthenticationCallback
location: class MsNavClient
3 errors

我发现 NTLMAuthenticationCallback类位于 jre/lib/rt.jar中,并尝试直接在 build.gradle文件中添加依赖项,但问题仍然存在。

这是 build.gradle文件:
apply plugin: 'java'

repositories {
mavenCentral()
}

dependencies {
// compile files('C:\\Program Files\\Java\\jdk1.8.0_131\\jre\\lib\\rt.jar')

testCompile group: 'junit', name: 'junit', version: '4.12'
}

有人可以帮忙吗?

最佳答案

我不知道这是否明智,但尝试使用以下命令(来自here)。在一个快速的问题示例中,使用它对我有用:

compileJava {
options.compilerArgs += ["-XDignore.symbol.file", "-Xdoclint:none", "-Xlint:none", "-nowarn"]
options.fork = true
options.forkOptions.executable = 'javac'
}

关于java - Gradle编译Java失败sun.net.www.protocol.http.ntlm.NTLMAuthenticationCallback,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47442012/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com