/Users/blake/Library/Java/JavaVirtualMachines/temurin-18.0.2.1/Contents/Home 로 확인 인된다.
jwebserver 를 시작하기 위해 bin 폴더까지 이동한다.
./jwebserver
Binding to loopback by default. For all interfaces use "-b 0.0.0.0" or "-b ::".
Serving /Users/blake/Library/Java/JavaVirtualMachines/temurin-18.0.2.1/Contents/Home/bin and subdirectories on 127.0.0.1 port 8000
URL http://127.0.0.1:8000/
127.0.0.1 - - [05/1월/2023:16:16:31 +0900] "GET /index.html HTTP/1.1" 200 -
127.0.0.1 - - [05/1월/2023:16:16:59 +0900] "GET /index.html HTTP/1.1" 200 -
추가 설명!
-h or -? or --help
Prints the help message and exits.
-b addr or --bind-address addr
Specifies the address to bind to. Default: 127.0.0.1 or ::1 (loopback). For
all interfaces use -b 0.0.0.0 or -b ::.
-d dir or --directory dir
Specifies the directory to serve. Default: current directory.
-o level or --output level
Specifies the output format. none | info | verbose. Default: info.
-p port or --port port
Specifies the port to listen on. Default: 8000.
-version or --version
Prints the version information and exits.
-b:바인딩할 ip
-p:포트
-d:제공할 목록
-o:console 출력등급
jwebserver -p 9000 -d / -b 127.0.0.1 -o info
루트 / 디렉토리의 내용을 확인 할수 있다.
jwebserver 구동(with java code)
테스트용 메인함수 하나 만든다.
public static void main(String[] args) {
System.out.println("구동완료!!!");
var addr = new InetSocketAddress(9898);
var server = SimpleFileServer.createFileServer(
addr, Path.of("/"), SimpleFileServer.OutputLevel.INFO);
server.start();
}