13

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

Thanks!

Jona
  • 13,325
  • 15
  • 86
  • 129
  • 1
    why you want this package in your app ? – jmj Dec 19 '10 at 20:53
  • This contains a HttpServer classes for building a simple server. I like to have that functionality. – Jona Dec 19 '10 at 20:53
  • 1
    http://www.java2s.com/Code/Jar/h/Downloadhttp221jar.htm - I download all my java libraries from java2s.com – HuH Jun 30 '15 at 09:54

3 Answers3

13

You can download it from

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.

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

5

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
3

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

The library can be found in jcenter, see here.

So just add it to your project's dependencies.

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    // ...
    compile 'com.sun.net.httpserver:http:20070405'
    // ...
}
alijandro
  • 11,627
  • 2
  • 58
  • 74