0
임베디드 부두를 jar 파일로 압축하려고합니다. 하지만 항상 내 "집"jar dir에 액세스 할 수 없습니다. html 파일은 어디에 위치해 있습니다. 여기에 내 런처 파일이 있는데, 클래스 로더 리소스 경로를 사용하려고했지만 null이 항상 있습니다.임베디드 부두가있는 컨텍스트 경로를 설정할 수 없습니다.
내 항아리에 경로를 가져 오는 몇 가지 해결책이 있지만 웹 페이지의 jar 파일에 액세스해야합니다.
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(8080);
server.addConnector(connector);
ClassLoader cl = Launcher.class.getClassLoader();
System.out.println(cl);
URL f = cl.getResource("/index.html");
System.out.println(f);
String webDir = f==null ? "/" : f.toExternalForm();
System.out.println(webDir);
WebAppContext context = new WebAppContext("/", "/");
context.setResourceBase(webDir);
누군가 내 항아리에 올바른 경로를 설정하는 방법을 알고 있다면 도와주세요.