Colin Harrington
Colin Harrington

Reputation: 4459

Java SimpleHTTPServer equivalent to "python -m SimpleHTTPServer"

Is there a simple java/jvm/groovy server that could be used to serve files simply like 'python -m SimpleHTTPServer ' http://docs.python.org/2/library/simplehttpserver.html

Upvotes: 2

Views: 1435

Answers (2)

Andrey
Andrey

Reputation: 304

There is JEP 408 in development to implement exactly that. Just using standard java command you will be able to start simple http server:

$ java -m jdk.httpserver [-b bind address] [-p port] [-d directory] \
  [-o none|info|verbose] [-h to show help message]

Unfortunately it won't be released until Java 18+ most likely. So in the mean time you would have to look for other solutions like this one for example or cook your own thing.

Upvotes: 0

sbglasius
sbglasius

Reputation: 3124

Check out this thread: http://groovy.329449.n5.nabble.com/groovy-one-liner-to-run-HttpServer-td3245538.html

$ groovy -l 80 SimpleWebServer

Upvotes: 2

Related Questions