diff -r 68c0229e193e -r 72a0dbfa2ae8 launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java --- a/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java Tue Mar 10 20:35:20 2015 +0100 +++ b/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java Wed Mar 11 08:50:51 2015 +0100 @@ -97,21 +97,14 @@ if (u == null) { throw new IOException("Cannot find InterruptedException class on classpath: " + System.getProperty("java.class.path")); } - final URLConnection conn = u.openConnection(); - if (conn instanceof JarURLConnection) { - JarURLConnection juc = (JarURLConnection)conn; - rt = Bck2BrwsrJars.configureFrom(null, new File(juc.getJarFileURL().toURI())); - } else { - throw new FileNotFoundException("Not a JAR URL: " + u); - } + rt = configureFrom(u, null, 3); } catch (URISyntaxException ex) { throw new IOException(ex); } final Bck2Brwsr all; try { URL u = r.get(Bck2Brwsr.class.getName().replace('.', '/') + ".class", 0); - JarURLConnection juc = (JarURLConnection)u.openConnection(); - all = Bck2BrwsrJars.configureFrom(rt, new File(juc.getJarFileURL().toURI())); + all = configureFrom(u, rt, 4); } catch (URISyntaxException ex) { throw new IOException(ex); } @@ -127,4 +120,21 @@ } }).generate(sb); } + + static Bck2Brwsr configureFrom(URL u, Bck2Brwsr rt, int parents) throws IOException, URISyntaxException { + final URLConnection conn = u.openConnection(); + if (conn instanceof JarURLConnection) { + JarURLConnection juc = (JarURLConnection)conn; + rt = Bck2BrwsrJars.configureFrom(null, new File(juc.getJarFileURL().toURI())); + } else if (u.getProtocol().equals("file")) { + File dir = new File(u.toURI()); + while (parents-- > 0) { + dir = dir.getParentFile(); + } + rt = Bck2BrwsrJars.configureFrom(null, dir); + } else { + throw new FileNotFoundException("Not a JAR or file URL: " + u); + } + return rt; + } }