简体   繁体   English

无法使用com.sun.net.HTTPServer.httpserver

[英]Can not use the com.sun.net.HTTPServer.httpserver

I am using Eclipse Indigo and Java jdk7. 我正在使用Eclipse Indigo和Java jdk7。

I'd like to create a litte webserver, but I am not able to use sun's webserver. 我想创建一个小网络服务器,但我无法使用sun的网络服务器。

When I type: 当我输入:

{
 com.sun.net.httpserver.httpserver server;
}

I get the following Eclipse-Error-Message: 我得到以下Eclipse-Error-Message:

Description Resource    Path    Location    Type
Access restriction: The type HttpServer is not accessible due to restriction
    on required library C:\jdk1.7.0\jre\lib\rt.jar
Server.java /REST-Server/src/com/test/restserver    line 7  Java Problem

What am I doing wrong here? 我在这做错了什么? I do not have to include any other jar? 我不需要包括任何其他罐子? Do I? 我呢?

You shouldn't use Sun's internal packages since they can be not present in other VM's. 您不应该使用Sun的内部软件包,因为它们可能不存在于其他VM中。 If you're sure you won't use other VM then Sun's/Oracle's, you can disable this warning in Project properties -> Java Compiler -> Errors/Warnings -> Deprecated and restricted API 如果您确定不会使用其他虚拟机,那么可以在项目属性 - > Java编译器 - >错误/警告 - >不推荐使用和限制的API中禁用此警告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM