Java 如何下载com.sun.net.httpserver 包?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4484989/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 17:57:10  来源:igfitidea点击:

How to download com.sun.net.httpserver package?

javaandroidcom.sun.net.httpserver

提问by Jona

I'm not familiar with where I can get the package com.sun.net.httpserver? I like to use this package in Android.

我不熟悉在哪里可以获取包 com.sun.net.httpserver?我喜欢在 Android 中使用这个包。

Thanks!

谢谢!

采纳答案by BalusC

It's part of Java SE 6. It's not published separately and also not included in Android. I'd suggest to look for another lightweight Java implementation of a HTTP server, like i-Jetty.

它是 Java SE 6 的一部分。它没有单独发布,也不包含在 Android 中。我建议寻找 HTTP 服务器的另一个轻量级 Java 实现,例如i-Jetty

回答by Daniel Worthington-Bodart

You can download it from

你可以从

https://bintray.com/bintray/jcenter/download_file?file_path=com%2Fsun%2Fnet%2Fhttpserver%2Fhttp%2F20070405%2Fhttp-20070405.jar

https://bintray.com/bintray/jcenter/download_file?file_path=com%2Fsun%2Fnet%2Fhttpserver%2Fhttp%2F20070405%2Fhttp-20070405.jar

It used to be available from Sun for Java 5 but they seem to have pulled the link. Don't know if it works on Android mind you.

它曾经可以从 Sun for Java 5 获得,但他们似乎已经取消了链接。不知道它是否适用于Android,请注意。

Old broken link http://download.java.net/maven/2/com/sun/net/httpserver/http/20070405/http-20070405.jar

旧链接 http://download.java.net/maven/2/com/sun/net/httpserver/http/20070405/http-20070405.jar

回答by alijandro

Android studio use jcenteras the default repository source. The more convenient way is adding the dependency to gralde configuration.

Android Studiojcenter用作默认存储库源。更方便的方法是将依赖项添加到 grade 配置中。

The library can be found in jcenter, see here.

可以在 中找到该库jcenter,请参见此处

So just add it to your project's dependencies.

因此,只需将其添加到项目的依赖项中即可。

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    // ...
    compile 'com.sun.net.httpserver:http:20070405'
    // ...
}