我sun.net.www.protocol.http.ntlm.NTLMAuthenticationCallback
在Java文件中使用。
代码从 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
class is in 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'
}
有人可以帮忙吗?