I try to pack embedded jetty into jar file. But all the time i can't access to my "home" jar dir, where is all html file situated. Here is my launcher file, i tried to use classloader resource path but all the time it is null.
I found several solutions for get path to my jar but I need to access files in jar for example my web pages.
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);
If someone know how to set correct path into my jar, please help me.